The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
infraction.php plugin
Hi,
I am looking to add a plugin in infraction.php. What I want to do is when an infraction is given to alter the 'credits' column (it is a custom column) in the user table of the user that is receiving the infraction. For example: user foo receives an infraction, and when he receives this infraction the plugin with do something like: PHP Code:
Thanks in advance, Ian EDIT: tried to post infraction.php in [php] tags but it made my msg too long to post. |
#2
|
||||
|
||||
I'm not real familiar with the infraction system, but I think you would add it using the datamanager somewhere in the do=update area of that page. If you aren't a programmer, it may be a bit more involved than you though. The best way to do this is with the datamanager. But, first you need to add the field you added to the database to the validfields for the user datamanager - in class_dm_user.php. Then you would set the info for that field using the datamanager (maybe using the hookinfraction_update_start ?). There are articles on the datamanager that you may want to check out.
|
#3
|
|||
|
|||
Hi Lynne, thanks for your reply.
Unfortunately serialized data is indeed over my head. Is there anyway i could just add a query in do=update at infraction_verify_permissions maybe? Like: UPDATE user SET credits = credits-1 WHERE userid = *the poster* Sorry if this is a stupid question, I can plug my way around VB sometimes but I am def not a programmer. If not I will prob have to just post in the paid services forum --------------- Added [DATE]1249744761[/DATE] at [TIME]1249744761[/TIME] --------------- Ok so I have this kind of working. I added this plugin at infraction_update_complete: PHP Code:
Now to expland on it a bit I wanted to wrap the query in an if condition: if the post is in forumid x, y or z then take away the point, if in any other forum do nothing. Can someone point me in the right direction to make this happen? |
#4
|
||||
|
||||
Have you tried $foruminfo['forumid']?
PHP Code:
Code:
$forumid $forum['forumid'] $foruminfo['forumid'] $thread['forumid'] $threadinfo['forumid'] $GLOBALS['forumid'] |
#5
|
|||
|
|||
I saw $threadinfo['forumid'] first in infraction.php first so tried it and low and behold it worked!
Thanks Lynne! You're always so helpful! |
#6
|
|||
|
|||
OK how about this one... I want to disable the PM users receive if they get an infraction in forums x, y and z
Here is the chunk of code I think that handles the PM: PHP Code:
Now isn't there a way I can add a plugin at private_insertpm_complete to just completely disable the PM for those three forums? |
#7
|
||||
|
||||
I think you would want to try to use a hook before that part of the code and just set $show['pm'] to false (so it skips that section) if it is in those forums. At least, that is what I would try to do first.
|
#8
|
|||
|
|||
PHP Code:
PHP Code:
|
#9
|
||||
|
||||
Did you try simply putting $show['pm'] = false; as the plugin to see if changing that variable would even work there? It could be that it is set farther down in the code and gets overwritten prior to it being used in which case you either need to manually modify the code or come up with another way of doing it.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|