Author Topic: New Item "Set Leve xxxl" (Set Posts)  (Read 3799 times)

Offline prisoner

New Item "Set Leve xxxl" (Set Posts)
« on: October 25, 2006, 12:20:08 am »
Hi,

i have modified the DecrasePost.php like this:

Code: [Select]
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2005 DanSoft Australia           |
|      http://www.dansoftaustralia.com/        |
\**********************************************/

//File: SetPost.php
//      Item

//VERSION: 1.0 (Build 1)
//DATE: 24th October 2006
//Author: Prisoner/Darkshadow !!!

class item_SetPost extends itemTemplate {
    function getItemDetails() {
        $this->name "Set Posts to 500";
        $this->desc "Sets <i>Someone else's</i> post count to 500!!";
        $this->price 200;
    }

    function getUseInput() {
global $context$scripturl$settings$txt;
        return "Member's Name: <input type='text' name='username'>
        <a href='
{$scripturl}?action=findmember;input=username;quote=0;sesc={$context['session_id']}' onclick='return reqWin(this.href, 350, 400);'><img src='{$settings['images_url']}/icons/assist.gif' border='0' alt='{$txt['find_members']}' /> Find Member</a><br>";
    }

    function onUse() {
        global $db_prefix$ID_MEMBER;

        $result db_query("UPDATE {$db_prefix}members
                            SET posts = posts - posts
                            WHERE memberName = '
{$_POST['username']}'",
                            __FILE____LINE__);

        $result db_query("UPDATE {$db_prefix}members
                            SET posts = posts + 500
                            WHERE memberName = '
{$_POST['username']}'",
                            __FILE____LINE__);

        return "Successfully set {$_POST['username']}'s posts to 500!";
    }

}

?>

In the first step it will decrase the posts from a choosen user to zero and then to 500 in this case.

What can you do with this ?
Well, i have a Forum with many posts related membergroups, the users will become more rights in a higher membergroup with more posts, i use 70 post releated usergroups. So my intention was an item to increase postcounter to a specified number of posts, this will enable a specified automatic "Level Up" for the users. Maybe in this case the next membergroups is at 501 posts, so the users have to do one more post and is in the next membergroup. When users buy an item "SetLevel_01" a user with higher "Level" is in danger...hehehe

You have to adjust the among of posts in this file (500) related to your settings in the membergroups and name it correct related to the affected membergroup. Here is the code that will reflect my membergroup "Level 03"

Code: [Select]
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2005 DanSoft Australia           |
|      http://www.dansoftaustralia.com/        |
\**********************************************/

//File: SetLevel_03.php
//      Item

//VERSION: 1.0 (Build 1)
//DATE: 24th October 2006
// $Id: SetLevel_03.php

class item_SetLevel_03 extends itemTemplate {
    function getItemDetails() {
        $this->name "Set User to Level 3 after 1 more Post";
        $this->desc "Sets <i>Someone else's</i> Level 3 after 1 more Post!";
        $this->price 200;
    }

    function getUseInput() {
global $context$scripturl$settings$txt;
        return "Member's Name: <input type='text' name='username'>
        <a href='
{$scripturl}?action=findmember;input=username;quote=0;sesc={$context['session_id']}' onclick='return reqWin(this.href, 350, 400);'><img src='{$settings['images_url']}/icons/assist.gif' border='0' alt='{$txt['find_members']}' /> Find Member</a><br>";
    }

    function onUse() {
        global $db_prefix$ID_MEMBER;

        $result db_query("UPDATE {$db_prefix}members
                            SET posts = posts - posts
                            WHERE memberName = '
{$_POST['username']}'",
                            __FILE____LINE__);

        $result db_query("UPDATE {$db_prefix}members
                            SET posts = posts + 29
                            WHERE memberName = '
{$_POST['username']}'",
                            __FILE____LINE__);

        return "Successfully set {$_POST['username']}'s posts to end of Level 2";
    }

}

?>

Maybe someone can edit it so that it will automatic change the membergroup without to do a 1 more post, i assume you have called the script post.php ????



Offline Masterhand

Re: New Item "Set Leve xxxl" (Set Posts)
« Reply #1 on: October 25, 2006, 03:02:21 am »
Wow, nice item.

I might create one sometime.

In fact...i'll add this and give it a test!
~If at first you don't succed, hide all evidence that you tried.~ - Homer Simpson