Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2012, 01:26 PM
Derpstra's Avatar
Derpstra Derpstra is offline
Seamstress!
 
Join Date: Aug 2012
Location: Seattle, WA/Charlotte, NC
Posts: 26
Gender: Female
Credits: 6,440
Derpstra is on a distinguished road
Default Page that changes player's usergroup

Since I just made a script to change the user's money, I thought I would go ahead and make one to change their usergroup as well. This seems especially useful if you have a group for people who donate or contribute to the site and you want to automatically change their usergroup when they buy something or whatever.

first, add this function to the page functions/functions_users.php:

PHP Code:
function changeusergroup($newusergroup$user) {
    
$currentusergroup $newusergroup;
    if (
$currentusergroup >= 0) {
        
$GLOBALS['adopts']->update("users", array("usergroup" => $currentusergroup), "username = '{$user}'");
        return 
true;
    }
    return 
false;

I placed mine under the function 'changecash' because they are so closely related.

then make a new page for the script. I called mine changeusergroup.php but you can call yours whatever you like!

PHP Code:
<?php

include("functions/functions.php");
include(
"functions/functions_users.php");
include(
"functions/functions_adopts.php");
include(
"functions/functions_friends.php");
include(
"functions/functions_items.php");
include(
"inc/lang.php");
include(
"inc/bbcode.php");

//***************//
//  START SCRIPT //
//***************//

$newgroup1;

if(
$isloggedin == "yes"){
changeusergroup($newgroup$GLOBALS['username']);
$article_title "Hello, {$username}!";
$article_content "You are now in usergroup {$newgroup}.";
}
else{
$article_title "You are not logged in!";
$article_content "You must be logged in to view this page!";
}

//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title$article_content$date);
?>
When they get to this page, their usergroup will change to the variable $newgroup. For my example, i set it to 1, which would make them an administrator. You'll want to change the number to the group id for your premium member group or whatever you want to change them to!
Reply With Quote
  #2  
Old 01-15-2017, 02:01 PM
ffsharriet ffsharriet is offline
Member
 
Join Date: Jan 2017
Posts: 22
Gender: Female
Credits: 4,803
ffsharriet is on a distinguished road
Default

How do I know which page this is located on? Sorry if I sound stupid, I'm very much a beginner when it comes to this sort of thing.

I've made it newgroup 7 for premium members, but where do I enter information to choose which page makes them change usergroup?
Reply With Quote
  #3  
Old 01-16-2017, 10:04 AM
Silver_Brick Silver_Brick is offline
Designer || Coder
 
Join Date: Oct 2016
Location: In Earth
Posts: 205
Gender: Male
Credits: 31,329
Silver_Brick is on a distinguished road
Default

you need to go to function/functions_users.php which is located in your root of hosting files and add this code -
Quote:
function changeusergroup($newusergroup, $user) {
$currentusergroup = $newusergroup;
if ($currentusergroup >= 0) {
$GLOBALS['adopts']->update("users", array("usergroup" => $currentusergroup), "username = '{$user}'");
return true;
}
return false;
}
then you need to create another page called changeusergroup.php and post this code -
Quote:
<?php

include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("functions/functions_friends.php");
include("functions/functions_items.php");
include("inc/lang.php");
include("inc/bbcode.php");

//***************//
// START SCRIPT //
//***************//

$newgroup= 1;

if($isloggedin == "yes"){
changeusergroup($newgroup, $GLOBALS['username']);
$article_title = "Hello, {$username}!";
$article_content = "You are now in usergroup {$newgroup}.";
}
else{
$article_title = "You are not logged in!";
$article_content = "You must be logged in to view this page!";
}

//***************//
// OUTPUT PAGE //
//***************//

echo showpage($article_title, $article_content, $date);
?>
but remember function_user.php is in function folder and you need to create new file called changeusergroup.php in main directory
Reply With Quote
  #4  
Old 07-30-2020, 12:27 AM
Micolai's Avatar
Micolai Micolai is offline
Loving Mysidia!
 
Join Date: May 2020
Location: Tennessee
Posts: 130
Gender: Female
Credits: 51,572
Micolai is on a distinguished road
Default

Anyway to update this to 1.3.4?
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion
Reply With Quote
Reply

Tags
script, usergroup


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing Usergroup Restriction for Shops Hwona Questions and Supports 5 08-13-2014 04:44 PM
Help Making Stats Page = Click Page & Lineages? squiggler Questions and Supports 2 02-22-2014 05:42 AM
Adopt Page & Pound Page change? tahbikat Questions and Supports 3 02-14-2014 04:19 PM
Error with usergroup changing Infernette Questions and Supports 3 02-11-2013 10:58 PM


All times are GMT -5. The time now is 03:21 AM.

Currently Active Users: 828 (0 members and 828 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636