The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Profile Fields & CSS
I'd like to have a profile field that lets users change the color that another field is displayed in. This is what I'm currently using:
PHP Code:
PHP Code:
Then use: PHP Code:
Is there a way to do this, or a more elegant way to do what I'm doing? |
#2
|
|||
|
|||
I think that should work. You're using $bbuserinfo in the class attribute above - is that what you meant? You used $post in the if/else statements above that. Of course you could use either depending on whether you want the post author's choice to show for everyone or if each user gets to choose what they see.
Where are you putting your CSS? Did you look at the page source to see if the class name is showing up like you'd expect? |
#3
|
|||
|
|||
Neither 'post' or 'bbuserinfo' works -- If I look at the source, the class is simply "display" rather than "Adisplay" or "Bdisplay"...
|
#4
|
|||
|
|||
And you're saying that the if/else statements worked? It seems like if that was working, then class="{vb:raw post.field101}display" should work (assuming it's in the same template).
|
#5
|
|||
|
|||
Yep the conditionals work, the classes do not -- which makes me think that the profile fields are being read after the css.
|
#6
|
||||
|
||||
Can you post exactly what you have done - what templates you modified and exactly how and any plugin code you've written.
|
#7
|
|||
|
|||
Hi Lynne,
The above code is in my postbit_legacy to display a custom user profile field, and a second user profile field selects the display color. Rather than evaluating each color with conditionals, I was wanting to use the profile field to call different css classes -- which seems more efficient than daisy-chaining conditionals in every post. I haven't done any plugins at all -- just that code in the postbit_legacy. |
#8
|
||||
|
||||
Can we get a screenshot of profile field 101 and 14 in the admincp (with the options) and a link to a thread and can you post 5 lines in the template directly above where you added the code please?
Also, you realize vb4 has elseif? Here's an example from the manual: Code:
<vb:if condition="$my_variable == 1"> <p>My variable is equal to one.</p> <vb:elseif condition="$my_variable == 2" /> <p>My variable is equal to two.</p> <vb:else /> <p>My variable is equal to neither one nor two.</p> </vb:if> |
#9
|
|||
|
|||
I'm a moron.
This works, I just had a syntax error in my class names :/ I've reduced all those conditionals down to: Code:
<span class="fontsizesmall {vb:raw post.field101}color">{vb:raw post.field14}</span> p.s. Thanks for the elseif tip! Didn't know that was new |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|