PDA

View Full Version : Miscellaneous Hacks - vbPluginOrder


hambil
03-29-2006, 10:00 PM
Keywords: plugin, order, hook

Description:
A simple but potentially very useful tool that allows you to set the order of execution for plugins within the same hook.

Features:

Fully Phrased.
Set the order of plugin execution within the same hook.Install
Download the vbPluginOrder_1.2.zip file.
Unzip and upload the files in the upload directory to your forum root.
Import the product file in your admincp.
Set the order for your plugins if needed and desired.Notes:
If you have Hellcat's real time page compressor installed it must be set as the first plugin in its hook after you activate plugin order.

Version 1.2

Fixed bug causing plugin order not to run on some systems because of cookie settingsVersion 1.1

Fixed nasty sql bug where I forgot to use TABLE_PREFIX for one join. Causes a problem if you have a table prefix (obviously) :)

Paul M
03-29-2006, 10:23 PM
Interesting, I will be taking a look at this later. :)

Zia
03-30-2006, 03:14 AM
:) helo

plugin order...? does that mean this hack will set the order(no 1,2,3.....) as per my desire?

Ummm whats the benifit of using this hack ?

thnx

hambil
03-30-2006, 04:07 AM
:) helo

plugin order...? does that mean this hack will set the order(no 1,2,3.....) as per my desire?

Ummm whats the benifit of using this hack ?

thnx
You can make one plugin run before another in the same hook. You probably won't need it until you really need it - then you'll be glad I wrote it :)

Paul M
03-30-2006, 06:50 AM
:)Ummm whats the benifit of using this hack ?
See ;

https://vborg.vbsupport.ru/showthread.php?p=933843#post933843

or

https://vborg.vbsupport.ru/showthread.php?p=935312#post935312

for recent examples.

Snake
03-30-2006, 11:55 AM
Good work. This could be useful since I'm having way too many plugins! :)

jazde86
04-03-2006, 09:50 PM
Help me, please!

Invalid SQL:

SELECT p.*, po.`order` FROM trillian_pluginorder AS po
JOIN plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order;

MySQL-Fehler : Table 'trillian_forum.trillian_pluginorder' doesn't exist

Oh no, my forum is down. What can I do? Its urgent! Thanks for your help.

hambil
04-03-2006, 09:54 PM
First, disable the product so your forum isn't down.

hambil
04-03-2006, 09:58 PM
Invalid SQL:

SELECT p.*, po.`order` FROM trillian_pluginorder AS po
JOIN plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order;

MySQL-Fehler : Table 'trillian_forum.trillian_pluginorder' doesn't exist

It sounds like the table didn't get created for some reason when you installed. Can you look at the database and verify if the table 'pluginorder' exists?

jazde86
04-03-2006, 10:08 PM
Cool, thanks for your reply.

In my database trillian_forum exists the table trillian_pluginorder

I've disabled the product and the plugin, but nothing has changed. :(

hambil
04-03-2006, 10:11 PM
You've disabled the product and you're still getting an error? Have you tried uninstalling it?

jazde86
04-03-2006, 10:16 PM
New Error:

Invalid SQL:

SELECT p.*, po.`order` FROM trillian_pluginorder AS po
JOIN plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order;

MySQL-Fehler : Table 'trillian_forum.plugin' doesn't exist

I don't come into the AdminCP to uninstall it, only the database is my my tool to work. The table plugin doesn't exist, thats correct because the correct name of the table is trillian_plugin at database trillian_forum.

Your Product creates the table TABLE_PREFIX . "pluginorder and the problem the problem is with the path. Can it helps disabeling all products and plugins or adapt the path in your product/plugin?

hambil
04-03-2006, 10:37 PM
Ah yes. That's a nasty bug. I'll fix and upload right away. Thanks.

jazde86
04-03-2006, 10:40 PM
Thank you, thank you, thank you. :) I hope that then everything is well. ;)

hambil
04-03-2006, 10:42 PM
Thank you, thank you, thank you. :) I hope that then everything is well. ;)
You're welcome. Updated and ready for download again. Let me know if it solves the problem please :)

jazde86
04-03-2006, 10:56 PM
Hmm...

Invalid SQL:

SELECT p.*, po.`order` FROM trillian_pluginorder AS po
JOIN plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order;

MySQL-Fehler : Table 'trillian_forum.plugin' doesn't exist

hambil
04-03-2006, 10:59 PM
Hmm...
Make sure you click 'allow overwrite', or better yet uninstall before you install the new one.

jazde86
04-03-2006, 11:08 PM
How can I install it with MySQL? Uninstallation is done by cleaning.

hambil
04-03-2006, 11:10 PM
How can I install it with MySQL? Uninstallation is done by cleaning.

You don't have admincp access?

jazde86
04-03-2006, 11:12 PM
No :(, thats my problem. Look at forum.trillian-deutsch.de :confused:

Your help is wonderful. :cool:

why there still is the error, although I deleted your plugin?

hambil
04-03-2006, 11:15 PM
If you remove the plugin from the plugin table, and you remove the plugin cache from the datastore table, you should have access to your admin cp again. That is, if my plugin is the problem anyway.

jazde86
04-03-2006, 11:26 PM
Oh yeah, very nice. Cool, I love you. ;) Great tip and now I'm really happy. :D

hambil
04-03-2006, 11:27 PM
Oh yeah, very nice. Cool, I love you. ;) Great tip and now I'm really happy. :D
Glad it worked. Now did the re-install work, or are you afraid to try now? LOL

jazde86
04-03-2006, 11:40 PM
Navbar in AdminCP is damaged. Warnung: array_keys(): The first argument should be an array in /includes/adminfunctions_navpanel.php (Zeile 147)

Warnung: implode(): Bad arguments. in /includes/adminfunctions_navpanel.php (Zeile 147)

Warnung: Invalid argument supplied for foreach() in /includes/adminfunctions_navpanel.php (Zeile 150)

And Shoutbox on index lost.

hambil
04-04-2006, 12:52 AM
Goto your plugin manager in the admincp, don't change anything, but just click on 'save active status'. That should rebuild the plugin datastore.

jazde86
04-04-2006, 07:59 AM
I've in my AdminCP no navbar and don't know the directlink to do it. In ModCP the navigation is ok. Argh, I've done, the navibar is there - but there is only the profilefields in postbit. :(

To many things deletet yesterday in the datastore-Database?!? :(

hambil
04-04-2006, 12:32 PM
I've in my AdminCP no navbar and don't know the directlink to do it. In ModCP the navigation is ok. Argh, I've done, the navibar is there - but there is only the profilefields in postbit. :(

To many things deletet yesterday in the datastore-Database?!? :(
Maybe. The url is yourdomain/admincp/plugin.php?do=modify

jazde86
04-04-2006, 12:38 PM
So is it, thx. Menu is very empty now... :-\

hambil
04-04-2006, 12:45 PM
So is it, thx. Menu is very empty now... :-\
What menu?

jazde86
04-04-2006, 12:49 PM
My Menu (Navigationsbar) in AdminCP, there is now only the field for profilefields in postbits.

hambil
04-04-2006, 12:52 PM
What exactly did you delete from the datastore?

jazde86
04-04-2006, 01:03 PM
In datastore


products - last line
pluginlist - many lines on the end
pluginlistadmin - many lines on the end


In plugins


2x vbPluginOrder


Delete Table pluginorder

hambil
04-04-2006, 01:10 PM
Okay. First, before doing anything else, backup your database. Then, try setting pluginlist and pluginlistadmin to blank, instead of editing them, and then go to the plugin page in admincp and click "update active" like before.

jazde86
04-04-2006, 01:23 PM
I cleaned the two things, but nothing has changed yet.

My last backup is from 2006-03-29 22-28... I've asked my webhoster for backup - waiting, waiting, waiting. The rest of my forum is ok.

hambil
04-04-2006, 03:14 PM
One little bug, so much trouble... sorry mate.

jazde86
04-04-2006, 03:20 PM
Do you have any idea to activate the full menu? Original files to admincp changed nothing.

One bug, everything broken . :( :( :(

hambil
04-04-2006, 04:34 PM
Well, it's not the files then, it's the database. Did you get the database restored?

jazde86
04-04-2006, 05:05 PM
Yeah, all is ok now! :banana:

I've started a new test forum, installed the products in the same order and copied the data from pluginlist and pluginlistadmin to my database. The cache is the bad thing, I think. Well done and thanks for your great work here.

I'll install your product soon as possible. I'm not so afraid. ;) :D

hambil
04-04-2006, 05:06 PM
Okay. Let me think. I have a couple of ideas still.

luroca
04-07-2006, 03:14 PM
This can be a very useful hack. I click install for future use :)
Is it working ok now?

Thanks

hambil
04-07-2006, 04:54 PM
This can be a very useful hack. I click install for future use :)
Is it working ok now?

Thanks
It seems to be :)

jazde86
04-11-2006, 09:39 AM
Sorry, but the plugin makes a lot of trouble. When there are "0" in a field, then other plugins doesn't work anymore, example for that ist the "Who has visited today"-Plugin. The same with "The threadprefix"-Plugin.

I deactivated it.

hambil
04-11-2006, 11:52 AM
Sorry, but the plugin makes a lot of trouble. When there are "0" in a field, then other plugins doesn't work anymore, example for that ist the "Who has visited today"-Plugin. The same with "The threadprefix"-Plugin.

I deactivated it.
Hmmmm. Could you be more specific? I tried installing two plugins in the same hook and setting the order of one to "0" and it worked fine.

jazde86
04-11-2006, 12:34 PM
Plugin "Members who have visited the forum":

cache_templates -> Members who have visited (1) -> Order "0" The Plugin doesn't shown on forumhome, switch to "1" and ahh, there is it. ;)

forumhome_start -> Members who have visited (2)


Other Plugins in cache_templates:

Post Thank You Hack
Top 'X' Stats by InfiniteWebby
vB Pager 3.0.4
VBGooglemap by StonyArc

robert_2004
04-20-2006, 01:41 PM
i can't get the 'plugin order' showing up in my adminCP's left menu pane.

hambil
04-20-2006, 02:27 PM
i can't get the 'plugin order' showing up in my adminCP's left menu pane.
Hmmm. You've uploaded all the files? There is an xml file for the cpnav that has to be uploaded.

robert_2004
04-20-2006, 04:09 PM
there are no files to upload on this thread mate. only the xml product.

hambil
04-20-2006, 04:29 PM
there are no files to upload on this thread mate. only the xml product.
Well, that's a problem. Now I'm wondering what the other people who install this are doing...

Give me a few minutes and I'll fix that and replace with a zip.

Logician
05-14-2006, 08:45 AM
Edit : Hambil fixed the problem below in his pluggin. Thanks!


This hack causes serious problems if your board has table prefixes. If it is installed in a board where tables are prefixed, the board start producing DB errors and it won't even allow you to access admin cp and disable product. So if you dont know what you are doing, you'll get stuck in a very bad position.

Problem & Fix:

This query in the pluggin is problematic:

SELECT p.*, po.`order` FROM " . TABLE_PREFIX . "pluginorder AS po
JOIN plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order

It should be:
SELECT p.*, po.`order` FROM " . TABLE_PREFIX . "pluginorder AS po
LEFT JOIN " . TABLE_PREFIX . "plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order

If you installed the hack and stuck with an DB error and you can't even access admin cp here is the fix for you:

Edit includes/init.php, find:
if ($vbulletin->options['enablehooks'] OR defined('FORCE_HOOKS'))

Before that add:
$vbulletin->options['enablehooks'] = FALSE;

Upload init.php.

This will cure DB error and now you can login to admin cp. Go to products and uninstall the product. Now delete the line you edit to init.php, reupload init.php and you are done.

@hambil : Sorry to post this into your thread and I appreciate your sharing your work with other vb members but I feel obligated to post this so that people won't get into trouble. It maybe a good idea to apply the fix I provided to your pluggin. Sorry again!

Boofo
05-14-2006, 08:55 AM
An easier way is to add a disable hooks line to the config.php. That way you could comment it out and use it again if you had to. ;)

define('DISABLE_HOOKS', true);

Marco van Herwaarden
05-14-2006, 09:00 AM
Thanks for providing this solution for members with problems.

Although your solution works, the proper way to disable all plugins from outside the ACP, is to add the following line to yhe includes/config.php:
define('DISABLE_HOOKS', true);

Boofo
05-14-2006, 09:07 AM
That's what I just posted above, sir. ;)

akanevsky
05-14-2006, 11:37 AM
Although I could see how this hack could be useful, I'd like to point out two things:
1. It would encourage a bunch of already-lazy coders to NOT care about making their hack in a way that would guarantee absense of conflicts with other hacks.
2. Instead of creating a new table and having to implement a whole new block of code, you should've added a displayorder column to the plugin table and used that.

hambil
05-14-2006, 12:34 PM
Warning:
This hack causes serious problems if your board has table prefixes. If it is installed in a board where tables are prefixed, the board start producing DB errors and it won't even allow you to access admin cp and disable product. So if you dont know what you are doing, you'll get stuck in a very bad position.

Problem & Fix:

This query in the pluggin is problematic:

SELECT p.*, po.`order` FROM " . TABLE_PREFIX . "pluginorder AS po
JOIN plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order
It should be:
SELECT p.*, po.`order` FROM " . TABLE_PREFIX . "pluginorder AS po
LEFT JOIN " . TABLE_PREFIX . "plugin AS p ON(p.pluginid = po.pluginid)
ORDER BY p.hookname, po.order
If you installed the hack and stuck with an DB error and you can't even access admin cp here is the fix for you:

Edit includes/init.php, find:
if ($vbulletin->options['enablehooks'] OR defined('FORCE_HOOKS'))
Before that add:
$vbulletin->options['enablehooks'] = FALSE;
Upload init.php.

This will cure DB error and now you can login to admin cp. Go to products and uninstall the product. Now delete the line you edit to init.php, reupload init.php and you are done.

@hambil : Sorry to post this into your thread and I appreciate your sharing your work with other vb members but I feel obligated to post this so that people won't get into trouble. It maybe a good idea to apply the fix I provided to your pluggin. Sorry again!
This was one of my first hacks. I thought I'd fixed the table prefix issue in this - not sure how it crept back in. Anyway, thanks for pointing out. Perhaps a PM next time? :)

Edit: In fact I know I did - it's in the description of version 1.1. Somehow version 1.0 got reuploaded.

hambil
05-14-2006, 12:37 PM
Although I could see how this hack could be useful, I'd like to point out two things:
1. It would encourage a bunch of already-lazy coders to NOT care about making their hack in a way that would guarantee absense of conflicts with other hacks.

That's silly. You can't possible predict what conflicts your hack might have with other hacks. And this isn't just for conflicts. What if you simply want to re-order things on forum home, for example?


2. Instead of creating a new table and having to implement a whole new block of code, you should've added a displayorder column to the plugin table and used that.
That's your opinion. I prefer not to modify vb core tables if I can help it. The new table is indexed and performance is not an issue.

akanevsky
05-14-2006, 12:45 PM
You can't possible predict what conflicts your hack might have with other hacks.

True, you cannot predict. But you can avoid altering vBulletin core with your hacks, which is what many coders do, and which is what leads to problems.

What if you simply want to re-order things on forum home, for example?

Last time I checked, to re-order things in the front end, you edit the templates. Templates, in their turn, do not have hooks so they have nothing to do with ordering.

That's your opinion. I prefer not to modify vb core tables if I can help it. The new table is indexed and performance is not an issue.

That's not just my opinion, it's a fact. "JOIN" always requires more from the server than a straightforward "SELECT FROM". However, it was only a suggestion. You're the boss of your hack, so you may or may not follow it, depending on what you want...

hambil
05-14-2006, 12:53 PM
True, you cannot predict. But you can avoid altering vBulletin core with your hacks, which is what many coders do, and which is what leads to problems.
Don't like my hack, don't find it useful, don't install it. Fine with me. I don't know why you feel you have to come in here and say so though. I created this hack because people requested, so obviously not all feel as you do. When did we start going into others hacks and publicly criticizing them?

Last time I checked, to re-order things in the front end, you edit the templates. Templates, in their turn, do not have hooks so they have nothing to do with ordering.
And then when you upgrade you have to re-edit all those templates.

That's not just my opinion, it's a fact. "JOIN" always requires more from the server than a straightforward "SELECT FROM". However, it was only a suggestion. You're the boss of your hack, so you may or may not follow it, depending on what you want...
It is most certainly an opinion, not a 'fact'. The cost of a proper join is nearly non-existant, especially compared to the design and maintainence benifits. It's called a relational database because it's designed for related tables, not flat tables.

hambil
05-14-2006, 12:56 PM
I removed the old 1.0 zip and reuploaded the 1.1. zip. That should take care of the table_prefix problem.

akanevsky
05-14-2006, 12:58 PM
Don't like my hack, don't find it useful, don't install it. Fine with me. I don't know why you feel you have to come in here and say so though. I created this hack because people requested, so obviously not all feel as you do. When did we start going into others hacks and publicly criticizing them?

To ensure that you aren't going to be criticized, don't release hacks.
Just to point out, however, I did say that I find how this hack could be useful.

And then when you upgrade you have to re-edit all those templates.

That, once again, has nothing to do with plugins.

It is most certainly an opinion, not a 'fact'. The cost of a proper join is nearly non-existant, especially compared to the design and maintainence benifits. It's called a relational database because it's designed for related tables, not flat tables.

I am not going to argue about it, I am just going to say that in my opinion, creating an extra field for just one table is a waste.

hambil
05-14-2006, 12:59 PM
I am only giving you suggestions. If you don't like people giving you suggestions, let everyone know publicly to rid yourself of it. Thanks for understanding.
Sorry if I over-reacted. I'm always open to suggestions. :)

I am not going to argue about it, I am just going to say that in my opinion, creating an extra field for just one table is a waste.
So noted :)

Logician
05-14-2006, 04:03 PM
Anyway, thanks for pointing out. Perhaps a PM next time? :)

Sorry I didn't want to offend at all! The reason I posted publicly was to post the fix in case some people got stuck after installation. If you updated the hack and prefer better I can delete my post, it is np.

hambil
05-14-2006, 04:06 PM
Sorry I didn't want to offend at all! The reason I posted publicly was to post the fix in case some people got stuck after installation. If you updated the hack and prefer better I can delete my post, it is np.
Nah. I deserve a little public humilation for 1) leaving out the table prefix in the first place and 2) screwing up and uploading the wrong version of the zipfile. :) That'll learn me!

jazde86
05-14-2006, 09:51 PM
hambil is very nice and at any time friendly. I like him. :cool: Thank you for updating it. :)

MThornback
05-21-2006, 04:54 AM
IE Error:

Fatal error: Call to undefined function: can_administer() in ../forum/index.php(485) : eval()'d code on line 220

Plugin Manager causes this on forumhome for IE, not FF for some reason....thats a switch eh?

hambil
05-21-2006, 05:25 AM
IE Error:

Fatal error: Call to undefined function: can_administer() in ../forum/index.php(485) : eval()'d code on line 220

Plugin Manager causes this on forumhome for IE, not FF for some reason....thats a switch eh?
Can I get access to your forum so I can try to debug this?

MThornback
05-21-2006, 05:26 AM
I have a guaest admin for just such an ocasion....PM your way shortly!

hambil
05-21-2006, 12:52 PM
I have a guaest admin for just such an ocasion....PM your way shortly!
Okay, it seems to be working all okay now. Let me know if you have any more problems.

I fixed a bug that was causing plugin order not to run.

The random numbers you where getting where due to Hellcats page compressor. I moved it to the first plugin in its hook and that seems to have fixed that.

MThornback
05-25-2006, 08:42 AM
I have good news hambil :p remember how I told you no dice? Well all of a sudden today it started working with this hack :cool: I told ya it would all work out in the end :D

hambil
05-25-2006, 03:15 PM
I have good news hambil :p remember how I told you no dice? Well all of a sudden today it started working with this hack :cool: I told ya it would all work out in the end :D
Woot! Thanks for the update :)

nowrap
07-10-2006, 12:15 PM
hello!

just installed the 1.2 release of this plugin. it killed me server due to high load.
the reason is quite simple. with this product activated it runs deactive plugins! without the deactivated plugins aren't executed!

did i made something wrong? uploading the 2 files and importing the product.xml

regards
.nowrap

hambil
08-28-2006, 01:18 AM
This hack is being retired and no longer supported, as it is included in 3.6.

hambil
04-12-2007, 11:48 PM
This hack has had the file removed, as it is not stable and the functionality already exists not in 3.6. Most likely this thread will get deleted for having no files when someone gets around to noticing :) If you really want it PM me.