• 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: How to change user's group using RSForm!Pro?

How to change user's group using RSForm!Pro? 4 years 8 months ago #40471

  • jftejada
  • jftejada's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Hello
I'm looking for a way to change the user's group using a form. I have this script:

$user = JFactory::getUser();
$groupId =15;
JUserHelper::setUserGroups( $user->id, $groupId );
$app = JFactory::getApplication();
$app->redirect(JRoute::_(JURI::root().'index.php'));


It works when I use the "addUserToGroup" function, but not when I use "setUserGroups"

Can anyone give me a hint, please?
The administrator has disabled public write access.

How to change user's group using RSForm!Pro? 4 years 8 months ago #40473

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

The addUserToGroup() function works since this does use integers, however the setUserGroups() function expects the second parameter to be an array instead and not an integer as you've specified.

More details on these helper functions here.
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.
The following user(s) said Thank You: jftejada

How to change user's group using RSForm!Pro? 4 years 6 months ago #40702

  • hello58
  • hello58's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
This worked for us. Insert comma-separated list of group IDs as needed.
$user = JFactory::getUser();
$groupIds = [12], [16];
JUserHelper::setUserGroups( $user->id, $groupIds );
$app = JFactory::getApplication();
$app->redirect(JRoute::_(JURI::root().'index.php'));
The administrator has disabled public write access.

This message has been removed by user's request. 4 years 1 month ago #41026

  • e1baa5e4b796521191eb58cb1555ca33@RSJOOMLA_DELETED
  • e1baa5e4b796521191eb58cb1555ca33@RSJOOMLA_DELETED's Avatar
This message has been removed by user's request.
Last Edit: 4 years 1 month ago by dee6282444ad34d1b0b8cce7844816a6.
The administrator has disabled public write access.

This message has been removed by user's request. 4 years 1 month ago #41027

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

This message has been removed by user's request. 4 years 1 month ago #41080

  • e1baa5e4b796521191eb58cb1555ca33@RSJOOMLA_DELETED
  • e1baa5e4b796521191eb58cb1555ca33@RSJOOMLA_DELETED's Avatar
This message has been removed by user's request.
Last Edit: 4 years 1 month ago by dee6282444ad34d1b0b8cce7844816a6.
The administrator has disabled public write access.

How to change user's group using RSForm!Pro? 4 years 3 days ago #41197

  • zorigo
  • zorigo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hmm.. I can get it to add the user to the new group, but not remove them from the current group. I have this set in the Script called after form has been processed area and I'm using the registration plugin. Where are you adding your code?
The administrator has disabled public write access.

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

  • 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!