MyBB-Plugins Forums

Full Version: Developing Modules
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I've taken a look at MyPlaza Turbo and it's a great plugin. However, I want to develop some site specific modules (items) for my site and I was wondering if there was a guide/tutorial with hooks and php examples. Big Grin
Thanks Pirata for the awesome plugin. Big Grin
Well it comes with a few demos, you can take a look at them and if you have any doubts just tell me and I'll try to clarify things
OK. I've gotten most of it down. Can you help with this, though?
In the _activation function, I don't get what all these are...I just need a table created with a uid column and a text string column.
When the user clicks the item, an input field will appear on the right. It will ask for a line of text, which is sent into the database. The admin receives a PM with the input and username, but the user does not see the PM sent when checking "Sent Items".
Thanks.
So basically you want this:
Code:
Table
[ uid ] - [ privatemessage ]
[ 1]    - [ blabla blablabla ]
etc

Then you want to have a text input field before the "buy item" button.
Right?
Then it gets inserted into the database (make sure you use escape_string to escape the text)

Am I right?
Do you have any PHP knowledge?
Exactly...but I want a "Bot" or something to send the PM. So the user doesn't see it in "Sent Items".
I have some PHP knowledge, made a few simple sites. But just started getting used to MyBB. Big Grin
MyPlaza has a built in function to send PM's.
Check the donate module, it does that in the _run function.
So you can easily do that in the _run function too. (the _run function is executed when buy the item)
Sorry, but I'm not that fluent in PHP...I just know basic syntax, database stuff.
So I see there are two parts that retrieve user info in donate.php
This code:
Code:
function donate_run($item)
{
    global $mybb, $lang, $buyRtnMsg, $buyLogMsg, $cache, $user;
    // get the "to" user information
    if($touid = intval($mybb->input['uid']))
    {
        if(!($touser = get_user($touid)))
        {
            $buyRtnMsg = $lang->invalid_user;
            return false;
        }
    }
    elseif($mybb->input['username'])
    {
        // retrieve user from username
        global $db;
        $query = $db->simple_select(MY_TABLE_PREFIX.'users', 'uid,username,'.MYPLAZA_MONEY_COLUMN.',receivepms', 'username=\''.$db->escape_string($mybb->input['username']).'\'', array('limit' => 1));
        $touser = $db->fetch_array($query);
        if(!$touser['uid'])
        {
            $buyRtnMsg = $lang->invalid_user;
            return false;
        }
    }
But how would change the user info in the second part to make the "From" field "Bot"?
Sent you the file in a PM. Please take a look at it, gimme some pointers. Thanks! Big Grin
Ok Pm'd you too Tongue