MyBB Community Forums

Full Version: A way to get current post pid in parse_message_start
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I create a plugin to allow HTML out of HTML forum.

In this plugin : i d a lot of update in content, and sometimes : that take very long time (if there are big post with dohtml )

I use parse_message_start and parse_message_end.
I want to update the pugin to allow to save the final message (and reset when needed).

Then : no update was made if not needed.

Something like this:
function mydohtml_parse_message_start($message) {
 global $post;
    if(mydohtml_cacheexist($post->pid)) {
        return ""; // empty then nothing to do
    }
    // Continue on action
}

function mydohtml_parse_message_end($message) {
 global $post;
    if($cached = mydohtml_cacheexist($post->pid)) {
        return mydohtml_cachemessage($post->pid)
    }
    // Continue on action
}
function mydohtml_datahandler_post_validate_post() {
    global $post;
    if(empty($post->pid)) {
        return;
    }
    mydohtml_emptycache($post->pid)
}

Just the idea.

I look at postbit but happen after parse_message
i look in build_postbit function : but no global var with cirrent post (with id).

Anyone have idea ?

PS : i case : current repo is framagit.org/EBDZ-MyBB-plugins/mybb-dohtml