The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Edit Post based on Group ID
Hi there,
I'd like to make it so when a parcticular group posts a new thread or post that the background changes to a colour I.E gold. I assume I'll be editing the postbit_legacy template and adding something like: Code:
<if condition="is_member_of($bbuserinfo, 6)">style="background:gold;"</if> Any help would be great thanks! |
#2
|
||||
|
||||
Here's something I came up with.....
PHP Code:
There are several things you have to replace. First, array(6) should be an array of groups you want to apply this to. Second, $bgcolor should be changed. This does not seem to get ALL areas of the postbit, but I gotta go to work in a few, so maybe you can find the last little bit. XD P.S., I put this on the parse_templates hook, but it could probably go elsewhere. (It's a shoddy job, but I JUST started learning this templatecache stuff.... and this actually showed me just how useful it can be to fiddle with it.) |
#3
|
|||
|
|||
Hi,
How would I edit this parse_templates hook? Where would I even find it? |
#4
|
||||
|
||||
Oh, sorry.
Admin CP ==> Plugins & Products ==> Add New Plugin That's where you add plugins. The "hook" is the specific place in the vB code where the Plugin code gets executed. You can title it whatever you want, execution order of 5 is okay. I'll be around in about six to eight hours to more-or-less "complete" it, but you could just use what I've got up there and see if that works for ya. |
#5
|
|||
|
|||
Oh I see, all I want is just the area where the message is to be a different colour But I will try and mess around with it.
If that's an easy fix or you know how please tell me, if not I'll wait for you to finish :P --------------- Added [DATE]1330476950[/DATE] at [TIME]1330476950[/TIME] --------------- EDIT: I removed all the parts with user info and got what I wanted Thanks so much!! |
#6
|
||||
|
||||
Oh, yes.
PHP Code:
Okays, time to get to work. If you have trouble or questions, post 'em and I'll help when I get back (unless someone else helps ya first). --------------- Added [DATE]1330502363[/DATE] at [TIME]1330502363[/TIME] --------------- I take the lack of response as heartening. :> You got it to work okay, I presume? |
#7
|
|||
|
|||
Quick question. I've got this working perfectly for the admin user group.
However I added a new plugin and changed the array to "5" for my super moderator code and it doesn't seem to work, I tried changing the execution array but I can't see what's going wrong. Is it that you can't have two plugins that change parse_templates? If so how can I edit the original code to recognise more than one group with separate BG colours for each. Thanks! |
#8
|
||||
|
||||
Instead of adding a new plugin, try this:
Change array(6) to array(5,6) And then add in more usergroups as you see fit. :3 |
#9
|
|||
|
|||
But I want it to be different colours depending on which user group
--------------- Added [DATE]1330519221[/DATE] at [TIME]1330519221[/TIME] --------------- EDIT: I tried adding a new BG colour array and then adding a new line for group 5 but I got allot of errors :P Code:
if (!function_exists('postbit_bg_injection')) {function postbit_bg_injection($subject) { global $bg_injection; $bgcolorAdmin = "#D4AF37"; $bgcolorMod = "#17200d"; $search = array('<div class="postbody">'); $replace = array( '<div class="postbody"\'.((is_member_of($post,array(6)))?\' style="background-color:'.$bgcolorAdmin.'"\':\'\').\'>' '<div class="postbody"\'.((is_member_of($post,array(5)))?\' style="background-color:'.$bgcolorMod.'"\':\'\').\'>' ); $bg_injection = true; return str_replace($search,$replace,$subject); }} if (!$bg_injection) {$vbulletin->templatecache['postbit_legacy'] = postbit_bg_injection($vbulletin->templatecache['postbit_legacy']);} |
#10
|
||||
|
||||
Oh, I see. Hmm. In that case, a little alteration is required:
PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|