Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Error with usergroup changing (http://www.mysidiaadoptables.com/forum/showthread.php?t=4009)

Infernette 02-11-2013 06:46 PM

Error with usergroup changing
 
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

Hall of Famer 02-11-2013 07:10 PM

Oh my goodness, thanks for bringing it up. It seems to be a minor glitch resulted from my playing with the usergroup system lol. Go to classes/class_membercreator.php file and find this:

PHP Code:

  public function getgroupcategory(){
     
// This feature will be fully implemented in Mys v1.3.3 or v1.3.4.
     
if($this->usergroup == or $this->usergroup == 2) return "Admin";
     elseif(
$this->usergroup == or $this->usergroup == 6) return "Mod";
     elseif(
$this->usergroup == 3) return "Registered";
     elseif(
$this->usergroup == 5) return "Banned";
     else throw new 
Exception('Cannot recognize usergroup category for this user, he/she may be a guest, a bot, or else...');
  } 

Replace by:
PHP Code:

  public function getgroupcategory(){
     
// This feature will be fully implemented in Mys v1.3.3 or v1.3.4.
     
if($this->usergroup == or $this->usergroup == 2) return "Admin";
     elseif(
$this->usergroup == 5) return "Banned";
     else return 
"Registered";
  } 


Infernette 02-11-2013 07:25 PM

Yaaaayyy It worked ^.^

Hall of Famer 02-11-2013 09:58 PM

Thats so good to know. ^^


All times are GMT -5. The time now is 12:31 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.