Current time: 03-21-2010, 05:07 AM Hello There, Guest! (LoginRegister)


Post Reply 
PM Function?
10-24-2008, 08:10 PM (This post was last modified: 10-24-2008 08:16 PM by Demonic.)
Post: #1
PM Function?
I'm planning on creating a plugin which is basically a user application, they can only submit once, once they submit they get a PM saying thank you and a bit of information regarding their application. In the ACP theres going to be another part where I review applications and send them a PM regarding if they got in or didn't.

So is there a PM Function which could save me time? Better yet, a source code documentation with the MyBB functions and things.

Do Follow Proxy Directory
Watch House Now Online For Free
Find all posts by this user
Quote this message in a reply
10-24-2008, 08:16 PM (This post was last modified: 10-24-2008 08:17 PM by flash.tato.)
Post: #2
RE: PM Function?
Start looking from line 167 of private.php Wink
PHP Code:
    require_once MYBB_ROOT."inc/datahandlers/pm.php";
    
$pmhandler = new PMDataHandler();

    
$pm = array(
        
"subject" => $mybb->input['subject'],
        
"message" => $mybb->input['message'],
        
"icon" => $mybb->input['icon'],
        
"fromid" => $mybb->user['uid'],
        
"do" => $mybb->input['do'],
        
"pmid" => $mybb->input['pmid']
    );

    
// Split up any recipients we have
    
$pm['to'] = explode(","$mybb->input['to']);
    
$pm['to'] = array_map("trim"$pm['to']);
    if(!empty(
$mybb->input['bcc']))
    {
        
$pm['bcc'] = explode(","$mybb->input['bcc']);
        
$pm['bcc'] = array_map("trim"$pm['bcc']);
    }

    
$pm['options'] = array(
        
"signature" => $mybb->input['options']['signature'],
        
"disablesmilies" => $mybb->input['options']['disablesmilies'],
        
"savecopy" => $mybb->input['options']['savecopy'],
        
"readreceipt" => $mybb->input['options']['readreceipt']
    );

    if(
$mybb->input['saveasdraft'])
    {
        
$pm['saveasdraft'] = 1;
    }
    
$pmhandler->set_data($pm);

    
// Now let the pm handler do all the hard work.
    
if(!$pmhandler->validate_pm())
    {
        
$pm_errors $pmhandler->get_friendly_errors();
        
$send_errors inline_error($pm_errors);
        
$mybb->input['action'] = "send";
    }
    else
    {
        
$pminfo $pmhandler->insert_pm();
        
$plugins->run_hooks("private_do_send_end");

        if(isset(
$pminfo['draftsaved']))
        {
            
redirect("private.php"$lang->redirect_pmsaved);
        }
        else
        {
            
redirect("private.php"$lang->redirect_pmsent);
        }
    }


Find all posts by this user
Quote this message in a reply
10-24-2008, 08:26 PM
Post: #3
RE: PM Function?
Thanks mate.

Do Follow Proxy Directory
Watch House Now Online For Free
Find all posts by this user
Quote this message in a reply
10-24-2008, 08:26 PM
Post: #4
RE: PM Function?
No prob. Smile

Find all posts by this user
Quote this message in a reply
10-26-2008, 02:09 PM
Post: #5
RE: PM Function?
Thanks, very usefull!

[Image: mybbaddonssignatur.gif]
Owning MybbAddons.com MybbDesign.com Mybb-Themes.com MybbDesign.co.uk and Mybboard.biz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: