vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Admins and mods have different post backgrounds when posting. (https://vborg.vbsupport.ru/showthread.php?t=200727)

DR AUTONAMUS 01-05-2009 02:30 AM

Admins and mods have different post backgrounds when posting.
 
When making a post is it possible to have the admins and mods have different post backgrounds when posting... so you can see what level they are(Usergroup)

If you would like pictures to explain what I mean just ask.

Kirk Y 01-05-2009 02:46 PM

Find the class tag of that td cell in your postbit and use a conditional statement to switch it around depending on usergroup.

HTML Code:

<td class="<if condition="is_member_of($post, X)">alt1</else>alt2</if>">...</td>

DR AUTONAMUS 01-06-2009 08:29 AM

So this would allow me to have the post bits like these:

I know these are phpBB but this is were I got the Idea from.
Admin:
http://www.freeimageups.com/files/1/Misc/admin.jpg
Mod:
http://www.freeimageups.com/files/1/Misc/mod.jpg
User:
http://www.freeimageups.com/files/1/Misc/user.jpg

So I need to make 3 different colors for the post bit dependent on there user group... Maybe more for future groups.

Lynne 01-06-2009 02:52 PM

Kirby's code is a bit off... it should be <else />, not </else>. But you can use a condition around any of the table column classes you want to change. It may be easier to 'read' if you do it this way:

HTML Code:

<if condition="is_member_of($post, X)">
<td class="whatever">
<else />
<if condition="is_member_of($post, Y)">
<td class="whatever2">
<else />
<td class="alt1">
</if>
</if>

You'll need to do that for every td tag you want changed.

TimberFloorAu 01-06-2009 03:08 PM

Can we alternate colour background on each subsequent post, within same usergroup?

Lynne 01-06-2009 03:19 PM

I would guess so, but I think you would have to get a plugin involved then.

DR AUTONAMUS 01-06-2009 03:26 PM

So this would be before every td tag in the postbit template ?

$post, X and $post, y would be the user groups?

and How would I make another alt# so I could have it on different styles

Lynne 01-06-2009 03:41 PM

You would do that for every td tag that you wish to change. I've seen some users only want to change the post background and that would be here in red:
Code:

    <if condition="$show['moderated']">
    <td class="alt2" id="td_post_$post[postid]">
    <else />
    <td class="alt1" id="td_post_$post[postid]">
    </if>

Make sure when you change it that all your <if> tags have a closing </if> tag.

x and y would be the usergroups.

To add another alt class, you would put it in the Main CSS for the style - at the bottom of that page.

SiK GambleR 01-06-2009 03:54 PM

now, as a secondary question to this, what if instead of changing the postbit BG I wanted to change just the admin or mod's font color, is that possible?

Lynne 01-06-2009 04:04 PM

Sure, you can either just change the class or add the css for the color inline there.

If you just want to change the background inline, instead of adding a new class, just go:
Code:

<td class="alt2" id="td_post_$post[postid]" style="background: #00ff00 url('smiley.gif') no-repeat fixed center;">
(All just a thrown together example - don't use that code cuz I have no idea what you would produce!) Doing so for the font color would be similar.

SiK GambleR 01-06-2009 06:15 PM

I can't seem to get it to work, any idea of what the code would be exactly? I have been toying for a little while ( I am still a noob with coding =[ )

MrEyes 01-06-2009 07:50 PM

Not exactly what you wanted but the following might help...

I have added the following code to the end of my headinclude template:

Code:

<if condition="in_array($bbuserinfo[userid], array(800,799,773,1))">
        <style>
                body { background: #870000;}
                .page { background: #870000; }
        </style>
</if>

What this does is change the background colour for all pages for user ids 800, 799, 773 & 1.

This was done so that mods/admins would know that they were logged into a mod account and therefore prevent accidently posting stuff as an admin/normal user when the opposite is required.

Obviously you can change those user ids to whatever you want

Lynne 01-06-2009 08:03 PM

Quote:

Originally Posted by SiK GambleR (Post 1703493)
I can't seem to get it to work, any idea of what the code would be exactly? I have been toying for a little while ( I am still a noob with coding =[ )

We can't tell what you did if you don't post the code your tried. Please use the code/php/html tags when you post it.

Mike-D 01-06-2009 08:40 PM

Te easiest way is to use Marco's Post Background Color AddOn. His AddOn is expandable in most ways and can be also added with the vB CSS Color Picker and Color Preview. Also the Permissions are pre-defined and can be used in a proper way :) IMO one of the best AddOns ever ;)

Lynne 01-06-2009 08:47 PM

Wow, I didn't know that existed. Learn something new every day!

SiK GambleR 01-07-2009 01:17 AM

OK, so I messed around a little, and I used this code (a friend helped me, as I said, I am a noob to vBulletin code, I have no idea what anything is or what to do/place things in):

Code:

<if condition="in_array($bbuserinfo[userid], array(2))">
        <style>
body,td,th {
        color: #60fffd;

                        </style>
</if>

I don't know where to place that, because if I put it in the postbit template, then it just edits the actual postbit, which is how it should work.

I, however, want to edit the BODY of the post.

Any ideas?

Lynne 01-07-2009 02:28 AM

That code is not going to do anything in regards to what the original post in this thread is about - changing the post background depending on who makes the post. That will change the whole *sites* background color based on who is viewing the page.

DR AUTONAMUS 01-22-2009 10:14 PM

Quote:

Originally Posted by Lynne (Post 1703372)
To add another alt class, you would put it in the Main CSS for the style - at the bottom of that page.

What would that need to look like?

Lynne 01-22-2009 10:27 PM

Something like this depending on what you want:

HTML Code:

.whatever {background-color: orange;}
Here's a reference page - CSS Background Properties

DR AUTONAMUS 01-22-2009 10:30 PM

Thanks :)

Prohibit 01-28-2012 01:21 PM

Does anyone know of a way to get this working on vb4?

Thank you in advance.

nerbert 01-29-2012 02:29 AM

In postbit template go down to about line 90 and modify:

HTML Code:

        <div class="postbody"
                <vb:if condition="$post['usergroupid'] == 5">
style="background-color:red;"</vb:if>
                <vb:if condition="$post['usergroupid'] == 6">style="background-color:blue;"</vb:if>>



All times are GMT. The time now is 05:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01357 seconds
  • Memory Usage 1,765KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (4)bbcode_html_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete