The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Custom profile field conditionals for check boxes
Hello. I'm trying to get some conditionals working for a Multiple Selection Checkbox profile field I've set.
I tried the following conditional, but it doesn't work with checbox values: Code:
<vb:if condition="$bbuserinfo[fieldX] == 'Show Me'"> <script> Do stuff here </script> </vb:if> Any ideas why it doesn't work with checkboxes? |
#2
|
||||
|
||||
First option
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
#3
|
|||
|
|||
Thanks, that works nice. The next thing I'm trying to do is that when User A views User B's profile, User A will see the effects as User B has set them. And vice versa.
The checkboxes they can pick create special effects to make their profile page look nicer. Similar to how $post['fieldX'] will display information in the user's postbit, is there a condition statement or variable that will do this for user profiles? Sorry if this request sounds confusing. |
#5
|
|||
|
|||
Just re-worded the post. Sorry, I did word that pretty badly.
I'm trying to give my users bit more freedom with how their profiles look. So I've given them a few checkbox choices they can pick to give them some effects with Javascript. Is there a statement, or variable, that will show the customizations the user chose when others see their profile, similar to the way that $post['fieldX'] will display customized information in the postbit? But in this case, on the member.php page. |
#6
|
||||
|
||||
Yes that's exactly what i figure out about an hour go Do you want this conditional to work in a plugin or in a template
|
#7
|
|||
|
|||
Oh nice. Well I was planning to put all of the statements and scripts in the headinclude templates. Could it all be done there, or do you think a plugin would be best?
Edit I found that the method you displayed in the 2nd post is not working for me. It appears to work fine for the first 2 check boxes, but if I pick any further choices it will run the incorrect script, or multiple scripts, as if it's ignoring the condition. Even if I only choose 1 check box. It's weird because it only behaves in that way for box #3 and onwards. |
#8
|
||||
|
||||
Can you show me your code? And i think it's better to do this in a plugin since i understand you just want to add js files to the page, am i right?
|
#9
|
|||
|
|||
Yes, but the obstacle I'm at is getting conditionals that check if a certain checkbox or checkboxes are selected.
For a quick concept test I put the following in my headinclude template: Code:
<vb:if condition="$bbuserinfo[field16] & 1"> <script> alert("You chose checkbox 1!") </script> </vb:if> <vb:if condition="$bbuserinfo[field16] & 2"> <script> alert("You chose checkbox 2!") </script> </vb:if> <vb:if condition="$bbuserinfo[field16] & 3"> <script> alert("You chose checkbox 3!") </script> </vb:if> <vb:if condition="$bbuserinfo[field16] & 4"> <script> alert("You chose checkbox 4!") </script> </vb:if> <vb:if condition="$bbuserinfo[field16] & 5"> <script> alert("You chose checkbox 5!") </script> </vb:if> |
#10
|
||||
|
||||
You must redouble the number each time...
e.g. (1,2,4,8,16,32,64 etc..) |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|