MyBB Hacks

Full Version: View New Subscribed Posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This is a simple plugin which adds a new link, next to the "View New Posts" link in the header, which will show all new posts since the user's last visit, but only those in threads they have subscribed to.
This can be useful, say, when combined with setting the default subscription mode for threads, for users to view updates to threads they've posted in.

If you have a modified header_welcomeblock_member template, the plugin may not be able to perform the correct modifications, so you may need to edit that template yourself.  The link for viewing new subscribed threads is:

Code:
search.php?action=getnew&subscriptionsonly=1

(replace "&" with "&" if putting in template)

This plugin will actually also filter for today's posts as well (but won't put a link for it)

Code:
search.php?action=getdaily&subscriptionsonly=1




Issues
  • Known problem with merging threads - see here for a solution
  • Small issue: this plugin uses a nested sub-query to do its work, as it's much easier to develop than a complex hack to get a joined query.  This may have a slight impact on performance, but I doubt it'll be much.
    Googling "mysql sub-query vs join performance" seems to show some people condemning sub-queries, with others saying the difference is practically nothing.
    The plugin uses a query similar to the following:

    SQL Code
    SELECT t.tid FROM mybb_threads t WHERE t.lastpost >='9999999' AND tid IN (SELECT tid FROM mybb_threadsubscriptions WHERE uid=1) AND t.visible>-1 AND t.closed NOT LIKE 'moved|%'

    as opposed to something like

    SQL Code
    SELECT t.tid FROM mybb_threads t LEFT JOIN mybb_threadsubscriptions s ON s.tid=t.tid WHERE t.lastpost >='9999999' AND t.visible>-1 AND t.closed NOT LIKE 'moved|%' AND s.uid=1

  • This plugin will add a unique index to the threadsubscriptions table, to try to help lessen the impact of the above mentioned speed reduction.  Ideally, MyBB should've included this key for data integrity reasons, but they didn't.  As such, the plugin needs to check for duplicates in the table before adding the index, and, if any are found, it will remove the duplicates.  If you don't want this, you can stop it by opening up the plugin file and deleting the line:

    PHP Code:
    define('LATESTSUBSCRIBE_ADD_INDEX', 1);

  • Queries used in this plugin probably only with with MySQL(i)
It will make us easier to "track" our Subscribed Threads. Thank you very much, Yumi Smile
Great, another Yumi!!! plugin!
Something I can use right away, too.  Smile
Thanks so much...

(06-20-2010 12:24 PM)ZiNgA BuRgA Wrote: [ -> ]Queries used in this plugin probably only with with MySQL
Safe to assume this includes MySQLi?
Very nice.
(07-03-2010 03:59 PM)Firefox Wins Wrote: [ -> ]Safe to assume this includes MySQLi?
Yeah, they're actually the same thing (just a different driver).
Found an issue with merging threads.  If MyBB decides to fix this, that'd be good, otherwise, you can do the following code modification (only works with MySQL(i)):
In inc/class_moderation.php, find:

PHP Code:
$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'");

Replace with:

PHP Code:
$db->write_query("UPDATE IGNORE ".TABLE_PREFIX."threadsubscriptions SET tid=$tid WHERE tid='{$mergetid}'");
$db->delete_query("threadsubscriptions", "tid='{$mergetid}'");

Note, this fix is not compatible with any fix MyBB issues (unless they decide to place a unique index on tid,uid as suggested in the bug report).

Just a small issue, but the header on the downloads template (as used in this thread) is breaking the forum layout. I see the first two code blocks are not getting the frame and so its stretching the forum layout (I have a smallish screen)
(07-04-2010 10:04 PM)leefish Wrote: [ -> ]Just a small issue, but the header on the downloads template (as used in this thread) is breaking the forum layout. I see the first two code blocks are not getting the frame and so its stretching the forum layout (I have a smallish screen)

I think it fixed now.
Hmm, I've been struggling on getting the CSS right for the code boxes - I'm pretty hopeless at that.  Looks like RateU has done his magic and fixed it Smile  What did you change, by the way?  I suspect this is an issue with my syntax highlighter plugin.
I changed .codeblock code class to maximum width 400px. I set it 600px before.

I don't want to call it as an issue, Yumi. I prefer to call it as "easter egg" with your Syntax Highlighter plugin. It will make a different layout if we did it with standard MyBB syntax highlighter Biggrin
Pages: 1 2
Reference URL's