Author Topic: Change Member Group  (Read 15322 times)

Offline celadore

Re: Change Member Group
« Reply #15 on: March 07, 2007, 07:11:31 am »
Couldn't find a solution, so created one (based on this item and Buy Membergroup by Chad on this thread:
http://www.daniel15.com/forum/index.php/topic,369.0.html

Code: [Select]
<?php
//File: AddMembergroup.php
//      Item

//DATE: Mar 07, 2007
//Author Taj

class item_AddMembergroup extends itemTemplate {
    function 
getItemDetails() {
    
$this->authorName "Taj";

$this->authorWeb "http://www.hostadore.com/";

$this->authorEmail "admin@hostadore.com";

        
$this->name "Add Membergroup";
        
$this->desc "Allows you to add yourself to a membergroup!";
        
$this->price 1;

        
$this->require_input false;
        
$this->can_use_item true;
    }

    function 
getAddInput() {
global $db_prefix;

$selectBox '<select name="info1">';

// Get all non post-based membergroups
$result db_query("SELECT ID_GROUP, groupName
FROM 
{$db_prefix}membergroups
WHERE minPosts = -1"
,
__FILE____LINE__);

// For each membergroup, add it to the list
while ($row mysql_fetch_assoc($result)) {
$selectBox .= "<option value='{$row['ID_GROUP']}'>{$row['groupName']}</option>";
}

$selectBox .= "</select>";
        return 
"Membergroup: ".$selectBox;
    }
    

    function 
onUse() {
        global 
$db_prefix$ID_MEMBER$item_info;

$additionalGroups mysql_fetch_array(db_query("SELECT `additionalGroups` FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__),MYSQL_ASSOC);

if(
$additionalGroups['additionalGroups']) {
$additionalGroups['additionalGroups'] = $additionalGroups['additionalGroups'].", ".$item_info[1];
} else {
$additionalGroups['additionalGroups'] = $item_info[1];
}


echo 
$additionalGroups['additionalGroups'];          
        
$result db_query("UPDATE {$db_prefix}members SET additionalGroups = '{$additionalGroups['additionalGroups']}'
         WHERE ID_MEMBER=
{$ID_MEMBER}",__FILE____LINE__);

        return 
"You have joined new membergroup {$item_info[1]}!!";
    }
}
?>
« Last Edit: March 07, 2007, 07:24:35 am by celadore »

babylonking

  • Guest
Re: Change Member Group
« Reply #16 on: March 20, 2007, 01:38:31 am »
Nice Item, I have only one question which is: How can i have another item that will have No Primary Membergroup in drop down box.


Thanks !


babylonking

  • Guest
Re: Change Member Group
« Reply #17 on: March 20, 2007, 03:12:07 am »
Never mind i figured out   8)

Offline Str8up-Nate

Re: Change Member Group
« Reply #18 on: May 03, 2008, 10:10:47 am »
hmmm would there be a way to make it so that when they bought this item for a secondary member group that it would only be for like 30 days? then they would be removed from the group?

Offline phantom111

Re: Change Member Group
« Reply #19 on: August 19, 2010, 05:45:23 am »
hmmm would there be a way to make it so that when they bought this item for a secondary member group that it would only be for like 30 days? then they would be removed from the group?

refresh

Can someone do this?