thellie
Member
Hey, it's been a while...
I'm setting up an admin dbase for our Thai intern students. Applicants fill in a form, which generates a record and their usergroup is pre-set to 'Pending decision' (usergroup 12).
A staff member then decides whether we will accept the application. I have set up an element '{application decision}' for the staff member to input the final decision:
'Pending' (which is the default status)
'Pass'
'Fail'
I have added a PHP form plugin to change the usergroup status to reflect the change in application status:
If 'Pass', usergroup changes to 'Intern' (usergroup 10)
If 'Fail', usergroup changes to 'Registered' (usergroup 2)
To make it easier, as we have quite a number of interns, I want to be able to change multiple rows rather than going into each form individually...
I have created update cols plugins, one for each possible decision. It works correctly as far as changing the '{application decision}' element - but as I don't open the form the PHP form plugin is not run (correct?).
I tried adding the PHP code to the post-eval field in the Update Cols plugin, but it does not change the usergroup.
Anyone have an idea how to do this using the Update cols plugin, in a single step (change status + change usergroup)? If not, I'll leave it so the staff member has to update each form individually, running the PHP form plugin instead.
FYI
Thanks
I'm setting up an admin dbase for our Thai intern students. Applicants fill in a form, which generates a record and their usergroup is pre-set to 'Pending decision' (usergroup 12).
A staff member then decides whether we will accept the application. I have set up an element '{application decision}' for the staff member to input the final decision:
'Pending' (which is the default status)
'Pass'
'Fail'
I have added a PHP form plugin to change the usergroup status to reflect the change in application status:
If 'Pass', usergroup changes to 'Intern' (usergroup 10)
If 'Fail', usergroup changes to 'Registered' (usergroup 2)
To make it easier, as we have quite a number of interns, I want to be able to change multiple rows rather than going into each form individually...
I have created update cols plugins, one for each possible decision. It works correctly as far as changing the '{application decision}' element - but as I don't open the form the PHP form plugin is not run (correct?).
I tried adding the PHP code to the post-eval field in the Update Cols plugin, but it does not change the usergroup.
Anyone have an idea how to do this using the Update cols plugin, in a single step (change status + change usergroup)? If not, I'll leave it so the staff member has to update each form individually, running the PHP form plugin instead.
FYI
Code:
// Get the connected user
$user = '{interns___intern_id}';
$decision = '{interns___application_decision_raw}';
if($decision === 'thumbsdown') {
// set the user in group ID = x
JUserHelper::setUserGroups($user, array(2) );
/* reload the user object so the user gets logged out
$session = JFactory::getSession();
$session->set('user', new JUser($user)); */
}
elseif($decision === 'thumbsup') {
// set the user in group ID = x
JUserHelper::setUserGroups($user, array(10) );
/* reload the user object so the user gets logged out
$session = JFactory::getSession();
$session->set('user', new JUser($user)); */
}
elseif($decision === 'pending') {
// set the user in group ID = x
JUserHelper::setUserGroups($user, array(12) );
/* reload the user object so the user gets logged out
$session = JFactory::getSession();
$session->set('user', new JUser($user)); */
}
else {};