The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How do I convert my "hack" to a plugin / addon???
Ok, I have the need to hack my code so that I can regulate who uses the [ img ] tag. My code goes in the newreply.php. I still need to fully test it, and I know I still need to edit additional files to make my change complete. Just stating this, before anyone lets me know my hack doesn't work. Its not done.
Anyways.....here is what I have done.... I have inserted the following code at about line 301 Code:
// If user primary group is not 6,7 or 17....remove the img tags $tmp = $vbulletin->db->query_first(" SELECT count(1) as num FROM " . TABLE_PREFIX . "user AS user WHERE user.userid = " . $vbulletin->userinfo['userid'] . " AND user.usergroupid in (6,7,17) "); if (0 == $tmp['num']) { //we need to remove the [img] tags.... $newpost['message'] = str_ireplace("[img]","",$newpost['message']); $newpost['message'] = str_ireplace("[/img]","",$newpost['message']); } I tried looking at some examples, but most of those where template changes. Thanks for your help, Dr00pY |
#2
|
||||
|
||||
You need to find the nearest hook call in the file, which in this case appears to be "newreply_post_start", a few lines above. Then you need to write it so it will work at that point in the file (which in this case means you need to edit $vbulletin->GPC['message'] as it's not yet assigned to $newpost['message']. Then you create the plugin in the APC Plugin manager.
BTW, that's a terrible way to check if a user is in those primary user groups, just use ; PHP Code:
|
#3
|
|||
|
|||
I knew there was an easy way to do that...just didn't know what it was. Thank you so much...ok so these "hooks" are the key....time to look into that....
Thank you again.... Dr00pY |
#4
|
||||
|
||||
You may already know this but go to admincp->something I cant remember-> Products and create a new product.
When you add your phrases and your plugins, you can associate them with the product for easy export/import. |
#5
|
|||
|
|||
Thank you all for the help....I think I got what I wanted done....
In case anyone else wants to do something similar....this is the code i'm using Code:
if (!in_array($vbulletin->userinfo['usergroupid'], array(6,7,17))) { //we need to remove the ","",$vbulletin->GPC['message']); } editpost_update_start newreply_post_start newthread_post_start You will ofcourse have to change the 6,7,17 to whatever groups you wish to give img access to. I still need to fully test everything, but as far as I can tell, that basically does everything I needed to do. And let me say WOW. I was afraid of creating a huge hack job of the code that would be very difficult to maintained. Instead I ended up with a set of plugins that make adding and modifing them easy, and will almost likely never affect any updates. I'm so happy I'm switching to VB for this reason alone...... Thanks again for the help...and if anyone knows if I missed any other place to put this code in, I would greatly appreciate it... Dr00pY |
#6
|
|||
|
|||
I think this is a similar question so rather than start a new thread...
I have some working php code that I don't know how to incorporate into my forum. Just under my banner I want some php code to write out some javascript - one of 2 scripts will run and the php chooses one randomly : PHP Code:
I was hoping to just add this php code in under the Admin CP, "Common Templates > header". What exactly do I need to do to make this work? I've just read various tutorials but can't see what I need. Thanks in advance for any ideas :up: |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|