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: 2414)

- 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
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #241
RE: XThreads
Hi again, still working on my set up .... my friend would like me to add a couple of fields for people with special diet requirements.

I have a custom thread field called diet - its a radio button, options Yes or No.
I have a second custom thread field (I decided to make it a multiline textbox as there are so many possible variations) called diettext. What would be slick is that this textbox ONLY shows for input IF the selected diet option is Yes.  I tried calling the globals threadfield value, but I think I have a fault in the syntax somewhere ....

Code:
<if ($GLOBALS['threadfields']['diet']['value']==Yes) then>
				<td class="trow1" width="50%"><div>{$tfinput['diettext']}</div></td>
<else>WHUT
</if>


This above code just displays nothing, not even the WHUT shows up. Is it possible to do this or am I just doing it wrong?



[Image: leelink.gif]
MYBB1.6 & XThreads
02-11-2011 11:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #242
RE: XThreads
Maybe something like this:

Code:
<if $GLOBALS['threadfields']['diet'] == "Yes" then>


02-12-2011 05:14 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #243
RE: XThreads
Hi RateU - yes, I had tried that too - the thing is I was hoping it could be dynamic - like when I clicked the YES button then the field would popup.
The code above only works on a page refresh, which is not what I was going for. That's why i put the [value] in hoping that it would pick it up and update on screen without the refresh

I actually got a kind of link going using a scriptaculous thing, but the user had to click on the WORD yes rather than the radio button, so it opened the div slickly but was not choosing the YES field. I tried the scriptaculous in a dropbox, but that was a fail as the text in the drop was the javascript. Frown

I will continue to prod at it.


[Image: leelink.gif]
MYBB1.6 & XThreads
02-12-2011 05:50 AM
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: #244
RE: XThreads
You need Javascript to do that.  PHP only works on the server, so if you want something to change dynamically on the client side, you need a client side script (ie Javascript).

My Blog
02-12-2011 08:43 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #245
RE: XThreads
Yes, I tried using a scriptaculous snippet - and I did kind of get it to work, but instead of launching when the user clicked on the radio button, the user needed to click on the WORD yes (the option value) which meant that the radio button was not chosen.  What I am struggling with is to get my snippet to run when they click on the button.


[Image: leelink.gif]
MYBB1.6 & XThreads
02-12-2011 09:57 AM
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: #246
RE: XThreads
I'm not sure about the JS library you're using, but make sure that you're sticking the event (onchange or similar) on the option button, not the text or label.

My Blog
(This post was last modified: 02-12-2011 03:21 PM by ZiNgA BuRgA.)
02-12-2011 03:21 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #247
RE: XThreads
This is actually the problem - I don't know how to put the event on the button - I don't really get which of the formats to change.

This is my code to attach to the button:

Code:
<a href="javascript:;" onclick="Effect.toggle('field', 'slide', { duration: 0.5 });">BUTTON NAME</a>



And this is what I will wrap the "appearing" multiline text box in:

Code:
<div id="field" style="display: none;">
    <div>
        Custom thread field
    </div>
</div>


It does work as a piece of code, but not from the radio button - just from the label.

I had a look round on the internet - and found various snippets to try and get the variables - here is one -

Code:
1
2
3
4
5
6
7
<script type="text/javascript">
//a variable that will hold the index number of the selected radio button
for (i=0;i<document.test.myradio.length;i++){
if (document.test.myradio[i].checked==true)
theone=i
}
</script>


But I can't find WHERE the variables are stored - I did a view source and got this:

Code:
<td class="trow1" width="50%"><div><label style="display: block; font-style: italic;"><input name="xthreads_diet" class="radio" value="" tabindex="__xt_9" type="radio">(Not set)</label><label style="display: block;"><input name="xthreads_diet" class="radio" value="Yes" checked="checked" type="radio">Yes</label><label style="display: block;"><input name="xthreads_diet" class="radio" value="No" type="radio">No</label></div></td>



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 02-13-2011 05:33 PM by leefish.)
02-13-2011 01:22 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: #248
RE: XThreads
(02-09-2011 10:16 AM)ZiNgA BuRgA Wrote:  Thanks for that....

Sure, it took a little while to track down the root cause of the error; Figuring out a solution was a good learning experience.

(02-09-2011 10:16 AM)ZiNgA BuRgA Wrote:  ...Perhaps this is a reason for not using an external forum cache... Erf

Normal usage will *not* produce this error  Tongue
(This post was last modified: 02-14-2011 03:13 AM by Firefox Wins.)
02-14-2011 03:09 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #249
RE: XThreads
@leefish ...well, you're putting the code in an <a> tag, not the actual input field.

Something like (can't remember ID of the form, change it if none is set)

Javascript Code
document.getElementById('myform').xthreads_diet.onchange = function() {
 // do stuffs here
};


My Blog
02-14-2011 10:07 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #250
RE: XThreads
Hmmm, well, I am horribly confused.

I ran a little test function on my new thread  - I put this code in the template:

Javascript Code
1
2
3
4
5
6
7
8
9
<script language="javascript" type="text/javascript">

var el = document.getElementById('xthreads_diet');
if (el)
el.onchange = function() { alert('changed'); }
else
alert("element not found");

</script>

To check that I had the data in right - but it fired the element not found. When I took the single quotes off 'xthreads_diet' then nothing happened.


I think this is beyond my small skill set at the moment, so I will have to give up for now. Thank you for your time Zinga, and I'm sorry I can't "get it", I am still new to javascript, so.



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 02-15-2011 02:15 PM by leefish.)
02-15-2011 01:42 PM
Visit this user's website Find all posts by this user Quote this message in a reply


Forum Jump: