• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Auto-Fill Group User Id into Hidden Field

Auto-Fill Group User Id into Hidden Field 9 years 4 months ago #33408

  • Roberts
  • Roberts's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 54
  • Thank you received: 1
I have tried without success to auto complete a hidden field in RSForm Pro

The code I'm using is as follows -
$user   = JFactory::getUser();
$db   = JFactory::getDbo();
$userId  = $user->GET('id');
IF ($userId) {
    $db->setQuery("SELECT `group_id` FROM `jos_user_usergroup_map` WHERE `user_id`='".$userId."'");
    RETURN $db->loadResult();

It doesn't return the group_id but I believe it should be doing just that !

Any ideas greatly appreciated
Last Edit: 9 years 4 months ago by Roberts.
The administrator has disabled public write access.

Auto-Fill Group User Id into Hidden Field 9 years 4 months ago #33416

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Try this instead:
//<code>
$user   = JFactory::getUser();
$groups = $user->groups;
return implode(",", $groups);
//</code>
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Auto-Fill Group User Id into Hidden Field 9 years 4 months ago #33420

  • Roberts
  • Roberts's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 54
  • Thank you received: 1
Many thanks Alex , a good and much simpler solution.

I did find a similar way to return the Groups I needed in CB ...thus
//<code>
$user   = JFactory::getUser();
$db   = JFactory::getDbo();
$userId  = $user->GET('id');
 
// IS the USER logged IN?
IF ($userId) {
  // Grab the VALUE FROM the DATABASE.
    $db->setQuery("SELECT `cb_groups` FROM `#__comprofiler` WHERE `user_id`='".$userId."'");
    RETURN $db->loadResult();
}
//</code>

Hope this helps someone.
The administrator has disabled public write access.

This message has been removed by user's request. 3 years 6 days ago #42009

  • e1baa5e4b796521191eb58cb1555ca33@RSJOOMLA_DELETED
  • e1baa5e4b796521191eb58cb1555ca33@RSJOOMLA_DELETED's Avatar
This message has been removed by user's request.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!