The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
vBulletin Hook Help
I have a custom profile field, and I have multiple options that can fill this field.
I have this profile field displayed on the postbit and I want it to display a result at random. Scenario: My profile field is: Username I have 2 usernames: Username 1 and username 2. I want the postbit to show username 1 and 2, but not at the same time. Maybe it shows Username 1 first, then username 2 on a refresh etc. I am not sure which hook to use, would it be a showthread or would it be member_customfields.. or another one? |
#2
|
||||
|
||||
You want the *postbit* template to show it? If so, you probably want a hook location like postbit_display_complete (or postbit_display_start).
|
#3
|
|||
|
|||
Thanks Lynne,
How would I begin this? PHP Code:
|
#4
|
||||
|
||||
Well, it depends on what you are trying to say with the condition. If you simply care if field5 exists, then you just say && $post['field5'] - you don't need to say equals true. And you are only doing this only for userid 1?
|
#5
|
|||
|
|||
Yeah.
I was thinking (based off your current code): PHP Code:
|
#6
|
||||
|
||||
Yeah. You may be able to just use rand() to pick a random number and then based on that spit out a different field5. It's hard to guess exactly what to do given the posted information. Something like (not real php below!!!):
PHP Code:
|
#7
|
|||
|
|||
Thanks Lynne, I guessed as much.
My forum is based around an online gaming community, and I have multiple usernames so I want it to randomly display each one. (Can rand() be used with strings?). Just need it to display either or, really. PHP Code:
|
#8
|
||||
|
||||
I don't know if that would work. I'm a trial and error coder. (I'm terrible at remembering syntax!) Just try it and see.
|
#9
|
|||
|
|||
PHP Code:
|
#10
|
||||
|
||||
I added this to postbit_display_complete and it worked just fine (and added $testing to my postbit):
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|