![]() |
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? |
You want the *postbit* template to show it? If so, you probably want a hook location like postbit_display_complete (or postbit_display_start).
|
Thanks Lynne,
How would I begin this? PHP Code:
|
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?
|
Yeah.
I was thinking (based off your current code): PHP Code:
|
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:
|
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:
|
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.
|
PHP Code:
|
I added this to postbit_display_complete and it worked just fine (and added $testing to my postbit):
PHP Code:
|
All times are GMT. The time now is 10:31 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|