MyBB Community Forums

Full Version: After a hook is ran, the board stops
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

I am facing a very weird problem. I have made a plugin that runs hooks at

datahandler_post_insert_thread_post
class_moderation_delete_thread_start
datahandler_post_update_thread

and when my functions run, the board simply stops. So, basically when I create a new thread, it will stop at

newthread.php?fid=2&processed=1

Then nothing. The thread is created, my function ran but after that, nothing, I'm not being redirected like I should.

Though, when I try this plugin on my local board I don't have this problem at all.

I am totally clueless here, I don't know why it doesn't redirect me after everything is done. I'm having this problem with the 3 hooks mentioned above (new thread, edit thread, delete thread).
Also, when I create a new thread where the function of my plugin isn't running, I works. So it's probably something in my function, but I don't see what it shouldn't stop anything at all. And the weirdest is that it's running on my local board.
I don't have any other plugins running those hooks.

Anyone had this problem before?

Thanks.
If the plugin works on your localhost but not on your website, then I guess it's pretty logic to say that your website has some kind of modification that is interfering with the plugin in the hooks.

Can you install another copy of MyBB on your webspace and see if the plugin works there (on a clean MyBB install)?
Ok, so I have installed two new installs of MyBB. One on the same server I was having issues in the first place and one on my local computer. Well, same thing occurs, the board stops on the server, but not on local.

So I don't know what this could be, I really don't!
Grrrr

This is the function being ran on the datahandler_post_insert_thread_post hook. The xxxx is because I'd like to keep what this plugin is doing a little bit "secret" for now Smile

function myautoxxxxx_edit_thread($this_thread)
{
    Global $mybb, $db; 
            
    $thread = $this_thread->thread_update_data;
    $thread['tid'] =  intval($this_thread->tid);
    
    $the_thread = get_thread(intval($thread['tid']));
    
    $thread['fid'] = $the_thread['fid'];
        
    $xxxxx_rule = myautoxxxxx_can_xxxxx($thread['fid'], $thread['tid']);
    If ($xxxxx_rule['state'] == true && $xxxxx_rule['rule'] == 3)
    {
        myautoxxxxx_delete_xxxxx($the_thread['xxxxx_id']);
        
        If ($thread['subject'] == '')
        {
            $thread['subject'] = $the_thread['subject'];
        }
                
        $details = array(
        "board_name"    => $mybb->settings['bbname'],
        "subject"       => $thread['subject'],
        "thread_link"   => $mybb->settings['bburl'] ."/" . get_thread_link($thread['tid']),
        "board_link"    => $mybb->settings['bburl']);
        
        $xxxxx = myautoxxxxx_parse_xxxxx($xxxxx_rule['xxxxx'], $details);
        $xxxxx = myautoxxxxx_xxxxx($xxxxx); 
        
        If ($xxxxx['state'])
        {
            $xxxxx_id = $xxxxx['xxxxx_id'];
            $tid = $thread['tid'];
            
            $db->update_query("threads", array("xxxxx_id" => $xxxxx_id), "tid = '$tid'", 1);             
        }      
    }
}
I don't see anything in particular there that would cause the loading to stop. I take it there's nothing in your error log for some reason?
No, absolutely nothing in my error logs.
Are there any major differences between your localhost and your actual host?
(2011-07-08, 10:45 AM)euantor Wrote: [ -> ]Are there any major differences between your localhost and your actual host?

No, nothing major. I checked the Apache & PHP configuration. Not to mention I never experienced any difficulty what so ever with this server.
Strange. It could well be caused by an issue in one of your functions, though the one you posted looked ok (save for the use of capitals - which I never use).
(2011-07-08, 12:48 PM)euantor Wrote: [ -> ]Strange. It could well be caused by an issue in one of your functions, though the one you posted looked ok (save for the use of capitals - which I never use).

Well if it was caused by one of my functions, why would it work when on the local system? And for the capitals, I never use them for variables or names, just for the "Global, If, Foreach, .."