Code:
<?php
include("inc/init.php");
//***************//
// START SCRIPT //
//***************//
if(!$mysidia->user->isloggedin){
// The user is not logged in, show generic login error message
$mysidia->displayerror("guest");
}
else{
$newgroup= 7;
$mysidia->db->update("users", array("usergroup" => $newgroup), "username='{$mysidia->user->username}'");
$article_title = "Hello, {$username}!";
$article_content = "You are now a part of the faction of Plutas.";
$mysidia->page->addcontent($article_content,TRUE);
}
//***************//
// OUTPUT PAGE //
//***************//
$mysidia->output();
?>
So, the script works Perfectly,it changes your usergroup to the desired one, but for some reason the usergroup isn't working. I made the group with the admin CP, and it registred that it was a viable group, and it even has the right ID i changed it to. Yet I get this error:
Fatal error: Uncaught exception 'Exception' with message 'Cannot recognize usergroup category for this user, he/she may be a guest, a bot, or else...' in /home/infern/public_html/classes/class_membercreator.php:28 Stack trace: #0 /home/infern/public_html/classes/class_membercreator.php(32): MemberCreator->getgroupcategory() #1 /home/infern/public_html/classes/class_mysidia.php(89): MemberCreator->create() #2 /home/infern/public_html/classes/class_mysidia.php(39): Mysidia->getcurrentuser() #3 /home/infern/public_html/inc/init.php(27): Mysidia->initialize() #4 /home/infern/public_html/index.php(3): require('/home/infern/pu...') #5 {main} thrown in /home/infern/public_html/classes/class_membercreator.php on line 28
And by manually editing in the usergroup, I get the same error. So I don't think it is my script doing it.
http://www.iaza.com/work/130212C/iaza13908980085500.png
http://www.iaza.com/work/130212C/iaza13908984561500.png - usergroups