Author Topic: Ask the Goofball  (Read 3562 times)

Offline chadk

Ask the Goofball
« on: October 22, 2006, 12:07:54 am »
I created a forum on my site called ASK THE GOOFBALL (you could use anything for this... ) In my forum it's so people can ask silly questions and get silly responses.  The thing os, only USERS can post a question (not even global moderators) and only the Forum moderator (nobody else, except the ADMIN) can respond to questions.  This creates an "ASK" forum.  You have to be using LOCAL PERMISSIONS for the goofball forum so you can turn replies for regular users.  Also so you can restrict the moderator's permissions in that forum so they're not a REAL forum moderator, the only permission they have that everyone else doesn't is the ability to REPLY to any topic.

So someone comes in, asks a question and only the moderator of that forum can respond.

This creates a GOOFBALL seat. ;)  Now, the fun... I created a shop item allowing anyone to put anyone else in the goofball seat. 

My item uses my Shop Log modification so you'll want to comment that out if you don't have a SHOP HISTORY forum in which you want major shop transactions recorded.  Though I recommend one, even if you set it to Admin only to read posts in there, at least you'll know wtf is going on when someone tries robbing the bank.  (you had to add the shop history code to that item yourself).

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

//File: AskTheGoofball.php
//      Item

//VERSION: 1.0 (Build 1)
//DATE: Oct 21, 2006
//Author Chad
//Helped by Karmaboost mod

class item_AskTheGoofball extends itemTemplate {
    function 
getItemDetails() {
    
$this->authorName "Chad";

$this->authorWeb "http://www.aviary.info/";

$this->authorEmail "generalchad@gmail.com";

        
$this->name "New Goofball";
        
$this->desc "Sets someone in the GOOFBALL seat in the Ask the Goofball forum!";
        
$this->price 250;

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

    function 
getUseInput() {
        global 
$context$scripturl$settings$txt;
        return 
"Who's the Goofball: <input type='text' name='goofball' size='50'>
         <a href='
{$scripturl}?action=findmember;input=goofball;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>";
    }

    function 
onUse() {
        global 
$db_prefix$ID_MEMBER$item_info$user$sourcedir;
require_once($sourcedir '/Subs-Post.php');
$goofballforumID 99//Set this to your Goofball forum ID
$shophistoryID=98;//Set this to 0 if you don't have a shop history forum

//Begin Shop history
if ($shophistoryID) {
$topicOptions['board'] = $shophistoryID//SHOP history forum
$topicOptions['id']=0//NEW topic
$msgOptions['subject'] = "I just put ".$_POST['goofball']." into the Goofball seat!"//Subject
$msgOptions['body'] = "I just put ".$_POST['goofball']." into the Goofball seat!"
$posterOptions['id']=$ID_MEMBER//Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function
}
//End Shop history
//Begin Goofball forum post - this is useful to let everyone know you have a new goofball
$topicOptions['board'] = $goofballforumID//Goofball forum - so everyone knows the tides have turned //change this to your goofball forum number
$topicOptions['id']=0//NEW topic
$msgOptions['subject'] = "I just put ".$_POST['goofball']." into the Goofball seat!"//Subject
$msgOptions['body'] = "I just put ".$_POST['goofball']." into the Goofball seat!"
$posterOptions['id']=$ID_MEMBER//Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function

            
$result db_query("SELECT ID_MEMBER

                                FROM 
{$db_prefix}members

                                WHERE memberName = '
{$_POST['goofball']}'"__FILE____LINE__);

            
$row mysql_fetch_array($resultMYSQL_ASSOC);

            
$goofball_ID $row['ID_MEMBER'];
            
        
$result db_query("DELETE FROM {$db_prefix}moderators
                               WHERE ID_BOARD = 
{$goofballforumID}",__FILE____LINE__);
        
$result db_query("INSERT INTO {$db_prefix}moderators (ID_BOARD, ID_MEMBER) 
          VALUES (
{$goofballforumID}{$goofball_ID})" //EDIT the 99 to the forum number that you use for the goofball posts
                               
,__FILE____LINE__);

        return 
"{$_POST['goofball']} is the new goofball!!";
    }
}
?>
« Last Edit: October 22, 2006, 06:25:37 am by chadk »