<?php//File: AddMembergroup.php// Item//DATE: Mar 07, 2007//Author Tajclass 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]}!!"; }}?>
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?