MyBB Hacks

Full Version: XThreads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Updated to v1.30:
  • move template modification code from _install function to _activate - this allows an admin to re-perform the template edits after they install a new theme, by deactivating and re-activating the plugin (rather than forcing an uninstall, or requiring manual template edits)
  • workaround for an editpost bug in earlier MyBB 1.4.x versions
  • fix bug with handling array of filters (thanks to RateU)
  • fix bug with multiple values and textbox/textarea inputs; it didn't work before, now it will assume that commas (textboxes) or newlines (textareas) are delimeters (regardless of what the display delimiter is) - it's probably not the nicest solution, which might be changed in a later version.  Note, I'm assuming no-one has relied on this feature (haven't seen it being used anywhere) so I'm not going to bother trying to fix it in the upgrader.
  • add ability to use text mask filter (for custom thread fields) to capture patterns, similar to how custom MyCodes operate; surround the capture pattern with brackets, and use {VALUE$1}, {VALUE$2} etc in display (item) format or unviewable value
  • add $filters_set variable for forumdisplay, for displaying which thread filters have been set.  It is an array, and you specify something like {$filters_set['my_thread_field']['value']} in templates to display the value of the filter "my_thread_field".  "value" can be replaced with a number of different things:
    • urlarg: URL parameter, eg 'filtertf_my_thread_field=label_a'
    • urlarga: URL parameter with preceeding ampersand, eg '&filtertf_my_thread_field=label_a'
    • urlargq: URL parameter with preceeding question mark, eg '?filtertf_my_thread_field=label_a'
    • forminput: hidden form input parameter, eg '<input type="hidden" name="filtertf_my_thread_field" value="label_a" />'
    • selected: for selecting in listboxes - is set to ' selected="selected"' for selected value (eg {$filters_set['my_thread_field']['selected']['labela']} is set if the filter is "labela")
    • checked: for selecting in checkboxes - as above, but set to ' checked="checked"'
    • hiddencss: puts hidden CSS if set - is set to 'display: none;' if filter is set, or '' otherwise
    • visiblecss: opposite of the above - set to 'display: none;' if filter is NOT set, or '' otherwise
    Note that for "value", if an array of filters is used, the values will be comma separated.  There's also two special entries defined:
    • {$filters_set['__all'][...]} can be used to grab URL/form parameters for all filtered thread fields (does not include inline search)
    • {$filters_set['__search'][...]} can be used for inline search filtering; the "..." can be replaced with any of the above values

Some examples of the $filters_set variable:

HTML Code
<div style="{$filters_set['thread_prefix']['visiblecss']}">
Filtering by thread prefix: {$filters_set['thread_prefix']['value']}
</div>

HTML Code
Filter threads by status:
<form action="{$forumurl}" method="post">
<select name="filtertf_status">
<option value=""></option>
<option value="resolved"{$filters_set['status']['selected']['resolved']}>Resolved</option>
<option value="open"{$filters_set['status']['selected']['open']}>Open</option>
</select>
<input type="submit" class="button" value="Filter" />
</form>

That's great! Thanks again zinga
Thank you very much, Yumi.
Something odd with X_threads. Maybe I missed it in the documentation, but here is my report.

My friend and I both have mybb boards. He is on 1.4, I am on 1.6. Today he contacted me because he was editing a forum and was having a problem getting his first post to show up. I checked his board and all was fine apart from his plugins being a bit outdated (he was still on 1.26 Xthreads and 1.5 Php Conditionals).  I immediately advised an upgrade to newest versions expecting this to fix the problem. It did not fix the problem and all his templates and forum settings were correct.

I went back to my own board and discovered I have a similar problem; I cannot add first_post templates to existing forums. If I add a NEW forum then I can add x_threads templates no issue. I have xthreads 1.3 and mynetwork and php in templates 1.6. I deactivated them all and reactivated them - I tried running without MyNetwork. I tried moving the forum from one category to another. Nothing fixed this glitch apart from creating a new forum.

Now of course this was not always so (AFAIK) - my downloads forum is forum id7 and has existed since before I had XThreads.  However, I did an edit of that forum - I changed the forum prefix to a NEW set of custom thread templates and suddenly I needed a couple of new templates for it to work as I wanted - specifically new thread and edit thread.

Im sorry this is a long post, and I hope it is not too garbled. I hope you can help me as I (and especially my friend) have a fair few links in sites we are affiliated with where the forum id(s) (not board id) is/are specified. It would be very bad to lose the links if we have to create new forums.
Unfortunately, I can't really see why that'd be the case...  If you (or anyone else) can set up a plain board and reproduce the issue, giving instructions as to how, I can try reproducing the issue which will allow us to start from a common ground.

(08-17-2010 05:23 PM)leefish Wrote: [ -> ]I cannot add first_post templates to existing forums.
Do you mean postbit_first* ?


One possibility may be a theme template overriding your global template, though it sounds unlikely.
Hi Zinga, yes those are the ones I mean - postbit_first. But only if I am adding them onto existing forums. When creating the forum prefixes in a new forum no problems at all.

I shall have to do a bit to get a clean install together, but I will do my best.
I can't reproduce it. Here is what I did:

1. Install a fresh MyBB 1.4
2. By default, there is a forum structure like this, right?
My Category
- My Forum
So, this forum already exist. Note: I didn't upload XThreads files in this step.
3. Create a new thread in My Forum forum.
It means, this thread already there, before I upload XThreads file in the next step.

4. Upload XThreads files
5. Install XThreads.
6. Create postbit_first template. Template content:

HTML Code
Test

Yeah, I need to make it "extreme" to view the difference.
7. Edit the My Forum to Show first post on every showthread page = Yes.

8. Open the thread.
I can see the difference. My first postbit contains "Test" word only. So, the postbit_first works for me.

Or am I misunderstanding Biggrin ?

Hi RateU, thank you for testing so far - I am adding the custom thread fields as well. I see from your report that this does not occur on a fresh install of 1.4 and the most recent XThreads. That is one variant I can rule out. So it has to be a plugin conflict - or a theme as Zinga said.

I am just thinking that it is odd that we both have the same issue on two different boards and servers. I would have blamed it on 1.6 but my friend is on 1.4. I was trying to think what we have in common:

We both have custom themes and custom templates and both have forums where we force a style onto users depending on which forum they are in.
We both have Xthreads, php in templates and global templates plugins installed.
We both have fairly complex layouts with lots of extra global templates for our Xthreads.
We both have your version1 pictures in profiles plugin.

Its not a huge deal - I can think of lots of ways round it, but it is happening and I use XThreads a lot and I wanted to report it.
I shall continue to test. I am using 1.6. I have installed XThreads v.1. I am going to install 1.1, 1.25, 1.27 and 1.3 in sequence as that is what I did before.
Well, I've tried it in my demo board. Look at this forum:

http://mynie.6te.net/demo/forumdisplay.php?fid=2

You can see that the forum id = 2. So, it is a default forum. Originally, it is My Forum under the My Category (I've renamed it to Category 1 - fid = 1). So, the forum already exist before I upload the XThreads files. Yes, I use a custom theme and template. I know, it is not a very custom Biggrin And I use 1 custom stylesheets attached to all pages. And there is a custom thread fields "attached" to that forum. Before this post, I don't use first post for that forum id.

You can try to view a thread there. You will find:

"This is nrm_postbit_first template" sentence if the post is first post, using horizontal postbit layout.
And "This is nrm_postbit_first_classic template" sentence if the post is first post, using calssic postbit layout.

Plugin I used in that forum:
1. XThreads 1.3 - MyBB Hacks (I've just updated it).
2. PHP In Template 1.6 - MyBB Hacks (I've just updated it - Not quite sure if I should update it, because I don't use My Network)
3. Other MyBB Hacks plugins and mine.

So, I'm not quite sure with which plugin it has a conflict. I just try to help to "track it down", Lee Smile But I can't reproduce it.
RateU - I have continued to plod on - based on the remark from Zinga I focused on themes and templates - and I THINK this is what happened:

I had that forum set to have a style forced on it. Its had that style and theme forced on it all through my updates of both forum and Xthreads. The theme is using the same template set as all the others.

So today I took that force style off and resaved the forum. It took a little bit longer than usual to save. I went into the forum and the xthreads option I had added was visible. Then I went back to the forum settings, and put the original force style back on again. It saved pretty quickly, and when I went back into the forum - the X_thread setting was there.

So, I think it was that - forcing styles, especially as my friend is ALSO forcing styles. So if there is any case of this issue coming up for anyone else I think its a case of:

Do you have force styles checked? If so, uncheck and save the forum. Open forum again, reapply forced style, save.

[attachment=163]
Reference URL's