Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

When thread notification is on, drafts trigger the notification #1

Open
Kretol opened this issue Aug 20, 2014 · 7 comments
Open

When thread notification is on, drafts trigger the notification #1

Kretol opened this issue Aug 20, 2014 · 7 comments

Comments

@Kretol
Copy link

Kretol commented Aug 20, 2014

When someone saves a draft of a post, the notification for it is created in the shoutbox similar to a normal thread. The link directs to /usercp.php?action=drafts.

@Kretol
Copy link
Author

Kretol commented Aug 20, 2014

Forgot to mention that I'm using MyBB 1.6.15, PHP version 5.4.26-pl0-gentoo, and MySQLi 5.5.37.

@TechyZeldaNerd
Copy link

Hmm, well this appears to be an issue where Mybb runs the "newthread_do_newthread_end" and the "newthread_end" hooks, even if it was only saved as a draft. I'm not really sure of a way to work around this unless we specifically check if the url is "usercp.php?action=drafts", but I'm not really an expert on Mybb.

@Kretol
Copy link
Author

Kretol commented Aug 20, 2014

Ah ha!
This can be fixed by ensuring the thread is visible. In function inferno_newthread():
Change

if ($settings['inferno_enabled'])
    {
        $inferno = inferno_init();
        $data = $mybb->input;
        $fid = $data['fid'];

        if ($settings['inferno_thread_post'] && !in_array($fid, explode(',', $settings['inferno_thread_forums'])))

to

if ($settings['inferno_enabled'])
    {
        $inferno = inferno_init();
        $data = $mybb->input;
        $fid = $data['fid'];
        $visible = $data['visible'];

        if ($settings['inferno_thread_post'] && $visible > 0 && !in_array($fid, explode(',', $settings['inferno_thread_forums'])))

@TechyZeldaNerd
Copy link

That seems to fix the issue. The only problem is that it when you finally post a draft, it doesn't appear in the SB, but that's a pretty minor thing.

@Kretol
Copy link
Author

Kretol commented Aug 20, 2014

Blargh. I should have tested that more! Apparently, though it does fix drafts not showing up, it also makes it so that no thread announcements are posted! Bwa, back to the drawing board.
It appears all posts will have 'visible' as 0 in the above logic whether or not they're saved as a draft or posted immediately (tried changing "> 0" to ">= 0" just to see what would happen, considering drafts as saved as a -2 in the 'visible' database column).

@TechyZeldaNerd
Copy link

Wait, really? Said code worked fine on my end, aside from what I mentioned before, so I'm not really sure what's going on.

Or nevermind... That's really odd though, I was certain I tested it out last night...

@Kretol
Copy link
Author

Kretol commented Oct 11, 2014

Got it!

I'm still using MyBB 1.6, so it's still applicable for me (though the same fix may work for 1.8)
Using the same block as before (with the addition of a change in the globals):

global $mybb, $db, $settings, $url, $lang, $tid;

if ($settings['inferno_enabled'])
    {
        $inferno = inferno_init();
        $data = $mybb->input;
        $fid = $data['fid'];
        $thread = get_thread($tid);

        if ($settings['inferno_thread_post'] && $thread['visible'] == 1 && !in_array($fid, explode(',', $settings['inferno_thread_forums'])))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants