MyBB Hacks

Full Version: XThreads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My Spiel
XThreads is one of my larger plugins which I have been working on for a while.  Originally planned to release it inline with MyBB 1.6, but who knows when that'll be out.  It perhaps doesn't include everything I wanted it to, but does have most of the things (plus I want to move onto other projects).

What does it do?
Take a look at RateU's forum for some nice ideas of what it can do.  I also have some more basic examples here of what can be done with XThreads.  I'm pretty sure there are many other applications of this plugin, but those examples just give you some simple ideas.

The basic idea is giving you the ability to define custom fields for your threads, and providing methods to give you a lot of flexibility with customising forums.

Warning: I'm not going to bother with "beta" labels and so on.  I've done some testing on this myself, but it's by no means extensive.  Use this at your own risk.

Installation Instructions: standard installation procedures apply - you can find them in the announcement here.
You may need to CHMOD the uploads/xthreads_ul/ folder to 0777 after uploading the files (probably won't though).

Upgrade Instructions: unless stated otherwise, the general procedure for upgrades is to simply upload the new files, then visit your AdminCP.  In there, you'll be presented with a notice to run the upgrade - just follow what it says from there on.

Usage Instructions: this is a complex plugin, and unfortunately, you're probably going to have to figure this out yourself, depending on what you want to achieve with this plugin.  HTML and CSS knowledge is strongly recommended; you should also be familiar with MyBB's template system.  Some demonstrations can be found here - hopefully these will give you a good idea of how things work.  I suggest looking at the thread descriptions example, as this is fairly easy to understand (IMO).  If you can understand how everything works, there, perhaps try out the gallery example.

Known conflicting plugins
- MyPlaza Turbo -
If you are using MyPlaza Turbo, note that the author decided to use a particularly odd method to implement certain functionality, practically destroying compatibility with any plugin which hooks into the forum add/edit routines.  I've included a patch to address this issue - you need to replace inc/myplaza/myplaza_admin_plugin.php with the following file (it's unlikely that this will be committed as the author has decided to discontinue development)
[attachment=102]

- PL9 Forum Icons -
Affects certain functionality.  See here for a solution.

- PHP in Templates, v1.4 or older -
Similar to PL9 Forum Icons - solution is just to update to the latest version.

- MyAdvertisements - (update: older versions only, later versions may not conflict)
Affects some thread functionality, see here for a solution.

- Group Post CSS -
See here http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=378&pid=59

All bug reports, suggestions, criticisms are appreciated (though I may not always implement suggestions) so please feel free to post them.
If you find this plugin useful, I would be grateful if you could give some token of appreciation for the work that has gone into this, and perhaps post some example usages you've come up with in the XThreads forum to help others get an idea of what can be achieve with this plugin (and for my own interest's sake Tongue).


Github: https://github.com/zingaburga/XThreads-MyBB-Plugin
Note: do NOT use the Github version, unless you know what you're doing
Changelogs: v1.10, v1.20, v1.21, v1.22, v1.23, v1.24, v1.25, v1.26, v1.27, v1.30, v1.31, v1.32, v1.337, v1.40, v1.41, v1.42, v1.43, v1.44, v1.45, v1.46, v1.47, v1.50, v1.51, v1.52, v1.53, v1.60, v1.61, v1.62, v1.63, v1.64, v1.65, v1.66, v1.67, v1.68
The following is just some general and technical information on this plugin.

The following information is out of date and probably will not be updated - see the included Documentation (under Undocumented Features -> XThreads Additions) for a more up to date version of this information

AdminCP UI Additions
  • Custom Thread Fields section under the Configuration tab - this is where you can add custom thread fields
  • XThreads Options section under forum add/edit - this allows you to customise various XThreads options on a per forum basis

Modified Templates - the following templates will be modified when the plugin is installed
  • editpost and newthread - adds {$extra_threadfields} to the template, which just displays any added thread fields
  • showthread
    • inserts {$first_post} before {$posts}; in XThreads, it's possible to customise the first post differently from other posts (requires the forum option "Show first post on every showthread page" to be set)
    • inserts {$threadfields_display} to display extra thread fields above the first post.  Evaluates the showthread_threadfields template.  In MyBB 1.4/1.6, this is inserted before {$classic_header}, whilst in MyBB 1.8 it is inserted before <tr> <td id="posts_container">
  • forumdisplay_threadlist
    • insert {$nullthreads} after {$threads}; this is just for display "null threads" if thread grouping is used
    • insert {$sort_by_prefix} before the first option in the sorter listbox - this is to give the option to sort threads by thread prefix
    • from the above, some other sorting options are added below the Sort By: Views option in the listbox
  • forumdisplay_threadlist_sortrating - similar to the above, inserts a sort by number of ratings option to the sorter listbox

Added Templates
  • editpost_first - allows you to have a different editpost template for editing the first post of a thread; defaults to {$editpost} which uses the default editpost template
  • forumdisplay_group_sep and forumdisplay_thread_null - for use with thread grouping; defaults to nothing
  • showthread_noreplies - displayed in the {$posts} variable for showthread only if the thread has no replies.  See the comment in the template for more information.
  • forumdisplay_searchforum_inline - inline forum searching - you don't need to bother with this unless you want to...
  • threadfields_inputrow or post_threadfields_inputrow (since v1.6) - how extra fields are displayed in newthread/editpost (of first post) - don't need to worry about this one either
  • showthread_threadfields and showthread_threadfield_row (since v1.6) - the default display of extra fields on showthread; former is the container, whilst the latter template is for each field
Although not an added template, you can also customise the various postbit* templates through postbit_first*, which will only apply to the first post.
Ah... Finally... Amazing, Yumi... Amazing. I will post my XThreads demo later. I'm in the process for creating a demo for it.
Awesome, thanks Smile
Can't believe you've released it, this is awesome! Thank you very much
Edit:
What's the problem with MyPlaza Turbo by the way? It was not easy to re-write the admin part specially for me since I didn't have much experience with PHP nor MyBB plugins so I probably broke something but I'm sure that did not happen with NewPoints since I coded everything separated from the rest of the Admin panel exactly for that reason.
Crap...

Oh okay, well, basically you copied all the code and stuck it in a function.  This has a few implications:
- Changes that MyBB make won't be present in your copied code
- You don't global the variables, so stuff like $fid isn't accessible by plugins which hook in there
- If another plugin does it (they shouldn't, but if anyway) you're going to get a conflict

I think I did it for the MyBB 1.2 version because it didn't have any usable hooks around the place for adding stuff into the form (I specifically added hooks in 1.4 to allow people to add stuff).  And also because labrocca was making a huge campaign that my plugin required (which were actually optional) code edits and it seems people caught wind of that, so I stuck that dirty code in there to show it can be done without code edits.  Work around sucks, but hey, if people buy it...
(05-01-2010 09:11 AM)ZiNgA BuRgA Wrote: [ -> ]Crap...

Oh okay, well, basically you copied all the code and stuck it in a function.  This has a few implications:
- Changes that MyBB make won't be present in your copied code
- You don't global the variables, so stuff like $fid isn't accessible by plugins which hook in there
- If another plugin does it (they shouldn't, but if anyway) you're going to get a conflict

I think I did it for the MyBB 1.2 version because it didn't have any usable hooks around the place for adding stuff into the form (I specifically added hooks in 1.4 to allow people to add stuff).  And also because labrocca was making a huge campaign that my plugin required (which were actually optional) code edits and it seems people caught wind of that, so I stuck that dirty code in there to show it can be done without code edits.  Work around sucks, but hey, if people buy it...

Oh yeah I knew about those but I couldn't find any workarounds besides that one so I had to go with it. Thanks for explaining Smile
Nice plugin! A lifesaver for sure! Yipi

Unfortunately Frown, there is a bug that I found... when trying to use template prefixes for a forum and displaying the first post on every page, it doesn't work.

For example, if I enabled "template prefix" asdf_ for forum A, and "show first post on every showthread page", instead of showing asdf_postbit_first, it will show postbit_first.

I didn't know where to post the bug so I posted it here... sorry if I'm wrong. Ouch
It should, as demonstrated by various guides in the XThreads forum.
If you could try this on a clean install of a forum, and provide step by step instructions on how to reproduce, it would be great.
Well, that was weird... did a reinstall, now everything shows fine...

The only thing I could think of doing differently is messing with the templates millions of times, and uploading before I installed MyBB.

Anyway, since it's not an issue, I'm happy Smile.
Reference URL's