Change User Group / Access Level on Submit?

I have a scenario where I want to show non-registered users "Content-A", registered users "Content-B", and registered users who have submitted a form "Content-C".

Is it possible to change a users access level upon submitting a Fabrik form? Or is ther another way to show different content on the same URL to users who have or have not submitted a form?
 
Is it possible to change a users access level upon submitting a Fabrik form?

Just the quick method i'd use to attempt this (note i'm referencing Joomla 2.5):

1. Your form should have a user element type to get the submitting users id number.
2. Add a php form submission plugin that runs "End of form submission (onAfterProcess)"
3. Enter the php code along these lines:
PHP:
$db =& JFactory::getDBO();
$user = JRequest::getVar('my_table___users_id');
$query = "UPDATE #__user_usergroup_map SET group_id='4' WHERE user_id='$user';";
$db->setQuery($query);
$db->query();

The above code would change the users group level to 4, which on a basic Joomla 2.5 install is the number for the Editor group level. The change would not take effect until the user logs out and back in though. Maybe after submission, force them to log out and redirect to a login screen. To do that, you could add something like:
PHP:
global $mainframe;
$mainframe->logout();
$mainframe->redirect('your login url');

I am still new to Joomla 2.5 though, so not entirely sure that's the only place in the database where you'd have to update to change the users permission level. I remember in Joomla 1.5 it was inside the #__core_acl_groups_aro_map table and you had to first get their aro_id from the #core_acl_aro table where their user id was in the value column.
 
Inradius, hello. I would gladly pay you for an hours time to research that by trying it out, and write it up with a "how to" on the wiki.

What I need to do is similar, though steps beyond; Create a Fabrik form (or forms) that asks a number of questions like: Who is the Corporate Executive in Charge of Quality Control, Who is the Production Executive in Charge of Quality Control, Who is in charge of quality control for Region 1, (2, 3, etc.) (or west, east, north or whatever the customer calls their territories), Who is in charge of QC at Local Facility X (Y, Z, etc.) and put them all into the Joomla User database with different attributes. But I am betting that will take more than an hour...but the above would be a start.
 
Thanks inradius! In this scenario, it is a very tight workflow and I need the changes to take effect immediately. The users will be logging into my site using their facebook account credentials, so maybe there is a way to silently log them out and then back in. Hmm....
 
I'm actually trying to find out how to rebuild the user's group and access cache without forcing them to logout and back in, for an unrelated issue.

If I find out soon, I'll try and remember to update this thread.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top