Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - celadore

Pages: [1]
1
Items / Re: New Item: Add membergroup
« on: March 14, 2007, 03:42:28 pm »
Sounds like a bit of a pain in the rear for your members to have to buy this every week or month, it would really p me off anyway if I had to do that unless being part of this special membergroup was absolutely essential (not just to get rid of ads and send PMs).

A simple solution would be to allow members to buy their way into the membergroup using this item and then purge the membergroup at the end of the month ready for next month.

To set-up a cron to do this for you does not require SMFShop in anyway, its to do with the Forum itself, so is kinda off topic.

If you are looking for something that logs the time when the person uses this item, counts down the time that he/she is a member of the member group and then removes them, you will probably have to hire a programmer to do that for you.  It's prob not difficult, but more than I would want to do :)


2
Items / Re: New Item: Add membergroup
« on: March 07, 2007, 05:14:34 pm »
No, you are mistaken.  You either have not tried it out yet or you specified the admin group yourself when you set it up.

This item allows the buyer to be added to only 1 membergroup which the administrator chooses when he create the item.  When you set up this item in the admin, it asks you which membergroup you want the purchaser to be added to.  So it is PRE-SET!  The buyer is ONLY added to the membergroup that you have set the item up for and does NOT have the option to join any membergroup he pleases.

The good thing about this one is that you can create a different item for EACH membergroup you want your members to be able to BUY their way into and at DIFFERENT prices too! 

So no security leak here as far as I can see.

3
Items / New Item: Add membergroup
« on: March 07, 2007, 07:17:30 am »
Save this as AddMembergroup.php under shop items.

I wanted to allow users to purchase additional membergroups.  The only solutions I found were the ChangeMembergroup in default SMF 3.0 and the BuyMembergroup by Chad (which didn;t work for me).  So I used both these to create a AddMembergroup item (I have only been using SMFShop for 20 minutes, but it appears to work for me).

What the Buyer gets:  The member who uses this item will have himself ADDED to the 1 membergroup for which the item was set-up for.  It will leave his primary membergroup unchanged.  The user does NOT get to choose which membergroup he wants to be added to NOR is he assigned to a random one.

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]}!!";
    }
}
?>

4
Items / Re: Change Member Group
« 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]}!!";
    }
}
?>

5
Items / Re: Change Member Group
« on: March 07, 2007, 06:34:20 am »
great item, however, when a user purchases this item his MAIN membergroup is changed.  What if we want to give this user access to ADDITIONAL membergroups.

Pages: [1]