A reported incompatibility with ZiNgA BuRgA's xThreads and PHP in Templates has been confirmed.
Both of these plugins are completely incompatible in their current state and may cause functionality problems with your forum. The issues with xThreads will be resolved in MyNetwork Core 1.0.1.
To make these plugins compatible with 1.0.0, please see the attached changes.txt file. Only make these changes if you're using xThreads or PHP in Templates and MyNetwork together, and only if you're comfortable changing files. If not, feel free to email (tom@xekko.co.uk) or PM me with your cPanel/FTP details and I'll happily make the changes for you.
Making these changes does not affect any xThreads or PHP in Templates functionality.
Thanks!
Tomm
changes.txt (Size: 698 bytes / Downloads: 12)
|
|
|
Thanks Tomm, I really appreciate all the help you have given me. I definitely think you had better install a "Buy me a beer and a sausage roll" random donation plug in because after all the work I saw you doing on this on my forum I'm sure you need one.
I installed post reputation and had a grand time running about the forum repping the posts
Moving on with Xthreads, I see that the reputation does not apply itself to the first_post template - there is a list of all the changed modified templates in XThreads here in the second post
http://mybbhacks.zingaburga.com/showthre...288&page=1
These are the modified templates which I guess maybe why they are not showing up
Xthread release thread Wrote: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)
* forumdisplay_threadlist - inserts {$nullthreads} after {$threads}; this is just for display "null threads" if thread grouping is used
I did a bit of quick testing and it looks like this happens if the showfirst_post on all pages is activated in the forum options
![[Image: leelink.gif]](http://www.leefish.nl/mybb/images/leelink.gif)
( Loves Opera 11.50)
|
|
|
|
Yeah I think I might need to add in a few template changes for xThreads. I'll be having a look early next week!
Glad you're having fun with it!
|
|
|
Hi Tomm,
Thanks for taking the effort to find those.
Unfortunately, I don't really have the time these days to look deep into your code. Taking a guess, it's probably you're custom templates object and the fact that you override it.
PHP Code:
function load_templates() { global $templates; require_once $this->path."core/handles/class_myn_templates.php";
$templates = new myn_templates; }
I can make the change in PHP in Templates, however, I suggest that you use a more appropriate object subclassing method if this is your aim. It's also good coding practice not to just assume that no other plugin is using object subclassing, and two instances of your plugin would potentially cause a conflict anyway.
You should grab the class name of the $templates variable before overriding it, eg:
PHP Code:
$templates_class = 'templates'; if(is_object($templates)) $templates_class = get_class($templates); eval('class myn_templates extends '.$templates_class.' { ... }');
If you don't like sticking everything in an eval(), you could create a stub and extend from it.
PHP Code:
$templates_class = 'templates'; if(is_object($templates)) $templates_class = get_class($templates); eval('class myn_stub_templates extends '.$templates_class.'{}'); class myn_templates extends myn_stub_templates { ... }
The above may still cause issues with my plugins as it does effectively destroy any set object variables. I would personally recommend my control_object() function (you can see the implementation in inc/plugins/xthreads.php), which properly subclasses any object, retaining class properties etc.
PHP Code:
if(!function_exists('control_object')) { function control_object(&$obj, $code) { static $cnt = 0; $newname = '_objcont_'.(++$cnt); $objserial = serialize($obj); $classname = get_class($obj); $checkstr = 'O:'.strlen($classname).':"'.$classname.'":'; $checkstr_len = strlen($checkstr); if(substr($objserial, 0, $checkstr_len) == $checkstr) { $vars = array(); // grab resources/object etc, stripping scope info from keys foreach((array)$obj as $k => $v) { if($p = strrpos($k, "\0")) $k = substr($k, $p+1); $vars[$k] = $v; } if(!empty($vars)) $code .= ' function ___setvars(&$a) { foreach($a as $k => &$v) $this->$k = $v; } '; eval('class '.$newname.' extends '.$classname.' {'.$code.'}'); $obj = unserialize('O:'.strlen($newname).':"'.$newname.'":'.substr($objserial, $checkstr_len)); if(!empty($vars)) $obj->___setvars($vars); } // else not a valid object or PHP serialize has changed } }
Hopefully this post has some use, and thanks for your work on the plugin!
|
|
|
Hi Yumi,
Thanks for the suggestions! I noticed the control_object function and thought about stealing that.
I didn't properly test the templates system as I quickly changed it to extend before I released the software - it did have its own custom templates which didn't affect any plugins but I can see why it will cause a few issues now.
xThreads will work pretty much 100% from what I can see with just MyNetwork's hook change to load before it, but I was really surprised to see PHP in Templates calling a function without a hook. I don't think I've ever seen that before in a plugin to be honest, and works fine when hooked into global_start. It would be great if that could be changed but I can see the reasons why you wouldn't want to! I'll probably implement control_object if that's OK with you?
|
|
|
|
Your code probably works, it's just that, say, someone else decides to use the same idea as you, then you're going to get a conflict.
I can change PHP in Templates - I'll probably need to hook into both global_start and xmlhttp (as long as they're the only places that templates are used). I don't think there's any particular advantage in performing the templates patch before any plugin hooks (it might even be better in some circumstances) apart from the fact that it saves me typing extra stuff (I code a bit too much for speed), so I don't mind the change. I just thought I'd give you a suggestion.
Interesting idea in MyNetwork BTW, I haven't had the time to look at it however.
And feel free to take anything you want from me. Ideally, I'd like credit if something of mine is been helpful, but I really don't care if no-one does anyway, so steal as much as you wish!
|
|
|
I won't be using your functions without crediting you, that's just like stealing imo. Even though I call it stealing.
MyNetwork's an idea I've had for a long time and came about because I really hate the way MyBB plugin culture is at the moment (the whole 'give them all these files and half the stuff they won't use' idea). I'm not wanting to be disrespectful to any plugin author at all, I just like to keep things clean and tidy and under a level of control.
An example would be Lee's forum. I was working with him to figure out what was causing MyNetwork's conflicts and it was pure hell trying to find anything in the mass of files, settings and templates that were installed there. It isn't his fault, and it isn't the plugin author's fault either, but imagine if I was just about to dump another whole load of files and settings into it; it would surely cause a lot more chaos than good.
The core itself is from 18 months ago so you'll probably find a hole load of crap coding here and there (mainly because I like to cut corners too). I'm always happy to take suggestions!
|
|
|
Hi Tomm, Zinga has released a new update to Xthreads and I'm a bit nervous to install it in case it breaks the fixes you made for me. Do you think it will be ok? Here is the release thread:
http://mybbhacks.zingaburga.com/showthre...44#pid3044
![[Image: leelink.gif]](http://www.leefish.nl/mybb/images/leelink.gif)
( Loves Opera 11.50)
|
|
|
I haven't tried it, but the only issue MyNetwork had with xThreads shouldn't be affected by the upgrade.
|
|
|
(12 Aug, 2010 7:10 pm)Tomm Wrote: Yeah I think I might need to add in a few template changes for xThreads. I'll be having a look early next week!
Hi Tomm, sorry to be a nag, and I see you are busy with the Profile Module, but did you have any opportunity to take a look at the problem I had with the post reputation button not showing in the first post of a given thread where I was using the XThreads postbit_first option?
Lee
![[Image: leelink.gif]](http://www.leefish.nl/mybb/images/leelink.gif)
( Loves Opera 11.50)
|
|
|
|