XThreads
Author Message
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)

.php  myplaza_admin_plugin.php (Size: 56.27 KB / Downloads: 2410)

- 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
(This post was last modified: 12-25-2015 12:46 PM by ZiNgA BuRgA.)
Find all posts by this user
Quote this message in a reply
Download: xthreads-1.68.7z (114.53 KB)
Plugin Version: 1.68
Last Updated: 12-25-2015, 12:46 PM

Downloads: 8,437
MyBB Compatibility: 1.4.x, 1.6.x, 1.8.x
Plugin License: GPLv3
Uploader: ZiNgA BuRgA
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #231
RE: XThreads
Can you explain your setup a little more?  Your first post seems to say that you have a listbox, but you don't want group B seeing some of the items in it.  Your second post seems to say that you have two separate fields instead, and you don't want group B to see the second field?

Hiding the (not set) value basically does the same thing as requiring entry.  If you're using templates to hide the input field entirely from some users (assuming not group because you could just change the Editable value), put in a hidden input field set to any valid value that you wish it to be.

My Blog
02-07-2011 04:45 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #232
RE: XThreads
Ok, sorry to be unclear. The problem is with listboxes AND radio buttons showing the NOT SET when it is not using the "everyone required" setting.

I have this wedding I have to make a signup forum for and there is
Ceremony (Attending) - (Custom thread field1 yes/no - radio button) & (# of guests) - (Custom thread field2 1 or 2 or 3 or 4 - listbox)
Private lunch (Attending) -  (Custom thread field3 yes/no - radio button) & (# of guests) - (Custom thread field4 1 or 2 or 3 or 4 - listbox)
Evening party  (Attending) - (Custom thread field5 yes/no - radio button) & (# of guests) - (Custom thread field6 1 or 2 or 3 or 4 - listbox)

The grouping is by user group - there are about 200 guests, so I don't think I can do it by user.

The private lunch (fields 3 and 4) is the only one that is not required by everyone - just for one usergroup - thats one radio button, one listbox. It just looks odd on the inputs when some of the fields have the (not set).

The marrieds to be are hoping I can give them reports on how many guests etc per part of the day - so for querying the database later I thought this would be the best set up.
I did try setting the default value to NO and default guests to 0 for these lunch fields, and then making them a hidden field.  But when I tested the error came up that I had not filled in a required field. Eg.I set group A as not able to edit the field - But for group B it is a required field - so it fails for group A or Group B see the not set with the risk that they may not fill the field in.

Link to site in progress if you are interested...  ttp://brownpaperbag.eu/index.php


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 02-07-2011 05:45 PM by leefish.)
02-07-2011 05:09 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #233
RE: XThreads
Oh, okay, I see what you mean now - thanks for the explanation.
Unfortunately the 'required' thing was meant to be more of a data constraint so making it required would mean that everyone needs to be able to set a value to it.  If it was only editable to a certain group and yet required, then the group which can't edit it would never be able to set a value, thus they'll never be able to fill the required constraint and never be able to create a thread.

Your issue can be solved if I implement permissions for individual values as I said earlier.  Basically it means that group B won't be allowed to leave the field as blank.

My Blog
02-07-2011 06:50 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #234
RE: XThreads
I see, I kind of thought that was so, but I thought it was worth a try to ask (if you don't ask, you won't find out....).

Well, I think IF this could be added it would be a major bonus - in the meantime I will explain to my rapidly less best best friend that she will just have to live with the brackets and the not set Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
02-07-2011 07:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #235
RE: XThreads
Sorry to post here, but I don't have permissions to post in the Template Conditionals forum (maybe that's a hint) but I am plodding on with this wedding forum thing. (see above posts)

My "client" does not wish the wedding guests to realise that not all guests are equal and that some have been invited to a slap up lunch whilst the rest can go buy a sandwich.... Therefore I cannot use coloured usergroups or things like that - there are two usergroups  - with the same title - (which the users do not know about) so I can filter out who is who a bit.

I have an overview of what guests have replied re this lunch (yes or no, number of people) and I have a default value of "not filled in" for these two fields. Unfortunately, as this cannot be a required field, then its possible for an invited lunchee to forget to fill out the field. Then it will get the default value of "not filled in".

I was trying to make an if statement in the forumdisplay_thread template  that basically says

<if thread starter is from usergroup 3 then> N/A<else>custom threadfield value</if> so that it will fill in the N/A instead of the real default value.

I am a bit stuck. Can anyone help?


[Image: leelink.gif]
MYBB1.6 & XThreads
02-08-2011 05:09 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #236
RE: XThreads
(02-08-2011 05:09 PM)leefish Wrote:  Sorry to post here, but I don't have permissions to post in the Template Conditionals forum
Fixed, thanks.

(02-08-2011 05:09 PM)leefish Wrote:  I have an overview of what guests have replied re this lunch (yes or no, number of people) and I have a default value of "not filled in" for these two fields. Unfortunately, as this cannot be a required field, then its possible for an invited lunchee to forget to fill out the field. Then it will get the default value of "not filled in".

I was trying to make an if statement in the forumdisplay_thread template  that basically says

<if thread starter is from usergroup 3 then> N/A<else>custom threadfield value</if> so that it will fill in the N/A instead of the real default value.

I am a bit stuck. Can anyone help?
I don't think there's a particularly neat way to do that from templates.
BTW, it's probably nicer to put it in the Display Format rather than templates.
Since I suspect that performance isn't really an issue, you can probably get around with something like this:

Code:
<setvar user>get_user($thread['uid'])</setvar>
<if $tplvars['user']['usergroup'] == 3 then>a<else>b</if>


I've also pushed usergroup permissions based on values into GitHub if you want to experiment with that to see if it suits your needs.  Basically, you'd make your field editable by only the groups you want to set them, then in the permissions, leave the value as blank (which means Not Set) and only allow Admins to set it to that value.


My Blog
02-08-2011 10:15 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #237
RE: XThreads
Thank you very much - that <set var> is what I was looking for - and yes, I think you are right regarding using display format rather than templates.

Re performance - yes, its  a one off site with a sole purpose and a fixed membership - once the wedding has happened site closes.

I will also go take a look at the github code - I think that this will be a popular change Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 02-08-2011 11:25 PM by leefish.)
02-08-2011 11:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Firefox Wins Offline
Member
***
Posts: 164
Joined: Mar 2008
Post: #238
RE: XThreads upgrade...
EDIT: I do "proper upgrades" on 'top-level' forums, and cruel hacking and experiments on other test sites.

After the last upgrade I was getting this error on index.php
  • Disclaimer: Normal usage will *not* produce this error!

Code:
1
2
3
4
5
6
7
8
9
10
The following warnings occurred:
Warning [2] Invalid argument supplied for foreach() - Line: 378 - File: inc/plugins/xthreads.php PHP 5.3.5 (Linux)
File 	Line 	Function
/inc/plugins/xthreads.php 	378 	errorHandler->error
/inc/xthreads/xt_forumdhooks.php 	637 	xthreads_get_tplprefixes
/inc/plugins/xthreads.php 	327 	xthreads_global_forumbits_tpl
[PHP] 	  	xthreads_global
/inc/class_plugins.php 	101 	call_user_func_array
/global.php 	96 	pluginSystem->run_hooks
/index.php 	18 	require_once


The solution is in my next post...

(This post was last modified: 02-09-2011 03:51 AM by Firefox Wins.)
02-09-2011 12:30 AM
Find all posts by this user Quote this message in a reply
Firefox Wins Offline
Member
***
Posts: 164
Joined: Mar 2008
Post: #239
RE: XThreads
FYI: To Anyone
XThreads includes hooks like these (for example)
...

Code:
$plugins->add_hook('admin_forum_management_edit', 'xthreads_admin_forumedit', 9);
$plugins->add_hook('admin_forum_management_add', 'xthreads_admin_forumedit', 9);
$plugins->add_hook('admin_forum_management_add_commit', 'xthreads_admin_forumcommit');
$plugins->add_hook('admin_forum_management_add_insert_query', 'xthreads_admin_forumcommit_myplazaturbo_fix');
$plugins->add_hook('admin_forum_management_edit_commit', 'xthreads_admin_forumcommit');

...to keep your current forums in sync with XThreads datacache.

If you add or edit forums from an 'external' script, (and also update your forum cache at the same time), then you might need this simple little piece of code:

PHP Code:
1
2
3
4
5
6
7
8
<?php
// sync_yzb.php
define('IN_MYBB', 1);
require_once './global.php';
require_once "inc/xthreads/xt_admin.php";
xthreads_buildcache_forums();
echo "Yes!";
?>

  Smile

02-09-2011 03:51 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #240
RE: XThreads
Thanks for that.  It's a bit crap that I can't hook into the $cache->update_forums() function.  Perhaps this is a reason for not using an external forum cache... Erf

My Blog
(This post was last modified: 02-09-2011 10:16 AM by ZiNgA BuRgA.)
02-09-2011 10:16 AM
Find all posts by this user Quote this message in a reply


Forum Jump: