PHP form plugin code suddenly not working

boyjah

Member
I have the following code as a PHP form plugin and it always worked until recently. Any idea why it would no longer work? Image attached showing settings for this plugin.

Screen Shot 2018-03-02 at 22.23.10.png

// get current user
$user = JFactory::getUser();
$userid = $user->get('id');
$groups = $user->groups;
// add the new group 10 if it isn't already there
if ( !in_array(10, $groups) ) {
$groups[] = 10;
}
// remove group 13 if it is present
if ( ($key = array_search(13, $groups) ) !== false ) {
unset($groups[$key]);
}
// save the new groups array
$user->groups = $groups;
$user->save();
// Get the db object
$myDb = JFactory::getDbo();
// Build the query
$myQuery = $myDb->getQuery(true);
$myQuery
->update('#__comprofiler')
->set('cb_usertype = "h"')
->where('id = '.(int)$userid);
$myDb->setQuery($myQuery);
// Run the query
$myDb->execute();
$app = JFactory::getApplication();
$error = $app->logout();
JFactory::getApplication()->redirect('index.php?option=com_content&view=article&id=422&Itemid=455&lang=jp');
 
Is the code actually running? If you put an exit ...

exit;

... as the first line, do you get a white page?

-- hugh
 
Sorry--I can't see an "exit;" anywhere in this code. But in answer to your query, yes the above code seems to be working now that I have reverted PHP back to 5.6.32
 
Sorry--I can't see an "exit;" anywhere in this code. But in answer to your query, yes the above code seems to be working now that I have reverted PHP back to 5.6.32
No, I said "if you put an exit in", in other words, add it as the first line and test.

Sent from my HTC6545LVW using Tapatalk
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top