MyBB Community Forums

Full Version: Plugin Changes coming in 1.6.5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
We now have the wiki page for 1.6.5 started, and I've included the changes to the plugin system, which include a serious overhaul. Please visit:
General 1.6.5 Page: [wiki]1.6.5[/wiki]
Direct to Plugin Section: [wiki]1.6.5#Plugin_System_Changes[/wiki]

This will require a minor update to plugins using several hooks.

If you're using a plugin that is no longer actively maintained that has hooks listed in the first section, you will need to post in the plugin support forum and hopefully someone with working knowledge of that plugin can tell you the changes needed to make it work again.

If you're using the hooks listed in the 2nd section the change is simply to receive by reference:
Change:
function example_func($var)
To:
function example_func(&$var)

Thank you.

EDIT Wednesday 2 Nov. 00:40am Eastern Time:
Due to a plugin that was already receiving by reference Stefan discovered you can use the receive by reference method (shown above in the case of the 2nd section) for either of the plugin type changes. It was not intended functionality, but does make authoring plugins much simpler.
/EDIT

EDIT Wednesday 30 Nov. 1056am Eastern Time:
Pavemen has graciously created a script to update plugins for you.
You can find it here: http://community.mybb.com/thread-108595.html
/EDIT
Interesting read. Thanks for sharing.

I must have missed "Parent Forum Lightbulbs" on the dev site.

The only problem I can see with reCAPTCHA, is that you can't check validation like the MyBB Captcha does. But I guess it's a feature that we can sacrifice for enhanced anti-spam measures.
I think I use a whole bunch of those in my various plugins.

will updating them now break anything if used in pre-1.6.5 installs?
Oh hell.

And is that a typo?

function example_finc(&$var)

"finc"
Will it tell you which plugins may break when upgrading?
oh boy... that's not a good thing to read about a minor update in mybb version

I don't have a clue if this will ruin some current features (some plugins simply didnt have a "temporary disable" button - They're installed or not) and could even make me change the forum script - but, anyway, thanks for the advice.

The thing is to test it exhaustly in xampp/lampp before upgrading to the real forums...
(2011-10-27, 08:21 PM)pavemen Wrote: [ -> ]I think I use a whole bunch of those in my various plugins.

will updating them now break anything if used in pre-1.6.5 installs?

It shouldn't. If a value is passed by ref, and you return it at the end of a function it works... and if you both pass and receive by ref it silently ignores one since its already "by ref". Or at least thats how I understand it.

(2011-10-27, 08:25 PM)labrocca Wrote: [ -> ]Oh hell.

And is that a typo?

function example_finc(&$var)

"finc"

I knew you'd have that reaction... but with PHP themselves deprecating passing by ref in favor of receiving by ref, this change had to come. Maybe not so drastic, but my thought was: Do it all now and get it over with. Especially with more and more servers getting upgraded to PHP 5.3.x where the deprecation occurs.

And yes, it was a typo. Fixed now, thanks Smile

(2011-10-28, 12:32 AM)aglioeolio Wrote: [ -> ]oh boy... that's not a good thing to read about a minor update in mybb version

I don't have a clue if this will ruin some current features (some plugins simply didnt have a "temporary disable" button - They're installed or not) and could even make me change the forum script - but, anyway, thanks for the advice.

The thing is to test it exhaustly in xampp/lampp before upgrading to the real forums...

Any plugin that doesn't properly use install/uinstall vs. activate/deactivate simply isn't a well written plugin. In most cases if you post in the plugin support forums I'm sure someone will be able to help. Be it staff or another community member. 90% of the time the edits will be very very easy to do.
(2011-10-28, 02:28 AM)Dylan M. Wrote: [ -> ]It shouldn't. If a value is passed by ref, and you return it at the end of a function it works... and if you both pass and receive by ref it silently ignores one since its already "by ref". Or at least thats how I understand it.
I haven't read the changes yet (I'll head over there now), but I just wanted to say that if you pass by ref (whether the notation is on the caller's end or the function's end) you don't have to return the variable you passed. Passing by reference means that if the function changes the value of that variable, it's not changing a value (that's the only difference between passing by value and passing by reference), it's changing the actual valid-outside-the-function variable. So if the function changes the passed variable's value, the caller will see the new value if it looks at the variable.

When you pass by value, you have to send back the changed value, because the original variable remains unchanged if "it's" changed in the function. (It's not, only a local copy of its value is.) Passing by value is "here's what $variable is equal to now". Passing by reference is "here's the address of $variable".
(2011-10-28, 03:09 AM)Rukbat Wrote: [ -> ]
(2011-10-28, 02:28 AM)Dylan M. Wrote: [ -> ]It shouldn't. If a value is passed by ref, and you return it at the end of a function it works... and if you both pass and receive by ref it silently ignores one since its already "by ref". Or at least thats how I understand it.
I haven't read the changes yet (I'll head over there now), but I just wanted to say that if you pass by ref (whether the notation is on the caller's end or the function's end) you don't have to return the variable you passed. Passing by reference means that if the function changes the value of that variable, it's not changing a value (that's the only difference between passing by value and passing by reference), it's changing the actual valid-outside-the-function variable. So if the function changes the passed variable's value, the caller will see the new value if it looks at the variable.

When you pass by value, you have to send back the changed value, because the original variable remains unchanged if "it's" changed in the function. (It's not, only a local copy of its value is.) Passing by value is "here's what $variable is equal to now". Passing by reference is "here's the address of $variable".

Yes, thats what my initial post says. I've also highlighted part of your post in bold. That isn't passing by ref, its receiving by ref. Which is now the standard in PHP as of 5.3.x (I don't exactly know which 5.3 version) and is what we're moving to with MyBB.

As for my comment about returning it, read what was asked and I quoted Wink Right now MyBB is passing these things by ref, but in 1.6.5 many will be passed by value and so need to be returned. If you update your plugins now to return the value, it wont affect them at all. They will continue to work as they should.
(2011-10-28, 12:32 AM)aglioeolio Wrote: [ -> ]oh boy... that's not a good thing to read about a minor update in mybb version

I don't have a clue if this will ruin some current features (some plugins simply didnt have a "temporary disable" button - They're installed or not) and could even make me change the forum script - but, anyway, thanks for the advice.

The thing is to test it exhaustly in xampp/lampp before upgrading to the real forums...

won't it work by doing this?
AdminCP >> Configuration >> General configuration >> Disable all plugins >> YES
Pages: 1 2 3 4 5 6 7