Current time: 03-21-2010, 08:16 PM Hello There, Guest! (LoginRegister)


Post Reply 
Quoted messages filtering
08-08-2008, 04:40 PM
Post: #1
Quoted messages filtering
Hello.

I'm writing plugin that adds several tags to myCode.

One of this tags should allow leave moderator notes in user's posts, so that only another moderators could see it.

For now this tags are processed correct on message displaying - only moderators can see it.
But when any user replys such messge with "Reply" button on post, or with multiquoting from quick reply form or common message form I cannot find hot to truncate this tags and text inside.

for example message is:
Code:
simple text
[moder]moderator's note[/moder]

What hooks should I use for filtering quoted texts?

Thanks.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-10-2008, 09:53 AM
Post: #2
RE: Quoted messages filtering
For the normal Reply, generally something like this:
PHP Code:
$plugins->add_hook('newreply_end''mystuff');
function 
mystuff()
{
 global 
$message;
 
$message preg_replace(...);


AJAX quoting is a little more difficult. I generally use something like this:
PHP Code:
$plugins->add_hook('xmlhttp''mystuff2');
function 
mystuff2()
{
    global 
$mybb;
    if(
$mybb->input['action'] != 'get_multiquoted') return;
    
ob_start();
    
    function 
mystuff2_shutdown()
    {
        global 
$message;
        if(!
$message)
        {
            
ob_end_flush();
            return;
        }
        
        
ob_end_clean();
        
$message preg_replace(...);
        echo 
$message;
    }
    
register_shutdown_function('mystuff2_shutdown');


I'm not sure if it works on all servers though.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-10-2008, 10:02 AM
Post: #3
RE: Quoted messages filtering
Thanks.
Will try your code.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: