In the showthread template there is this code:
Code:
<vb:if condition="$show['closethread']"><span>+</span> {vb:rawphrase reply_to_thread}<vb:else />{vb:rawphrase closed_thread}</vb:if> Code:
<vb:if condition="$show['closethread']"> |
This conditional is being placed in a forum block, but doesn't work correctly. I only wish to display the code to members who are logged in. Not guests.
Here's what I have: Code:
<vb:if condition="$show['member']"> Thanks! |
@BirdOPrey5
thx, but its not work to me.. :( * my code at postbit_legacy @tundrasoul may be this..? Code:
<vb:if condition="$show['guest']"> |
Quote:
|
or this.. ?
Code:
<vb:if condition="!is_member_of($bbuserinfo, 1)">Show this to user group not guest</vb:if> |
Quote:
The code still displays to everyone including guests. |
@tundra
this is worked for me : Code:
<vb:if condition="$bbuserinfo['usergroupid'] == 1"> |
Quote:
Did you try it in the forum block code? It doesn't work there for me, using vB 4.13. |
Quote:
For example the closedthread check is only done in showthread, not postbit, so you have to pre-register it for postbit. |
hi
how to display Google ads to the guest and in home page only? |
Quote:
Code:
<vb:if condition="$show['guest'] AND THIS_SCRIPT == 'index'"> |
Quote:
thanks lynne but this will occur Warning: Invalid argument supplied for foreach() in [path]/includes/functions.php on line 3416 The following error occurred when attempting to evaluate this template: %1$s This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish |
Change the = to == and try again. :)
|
How can I create a condition based on "Social Groups" (no user groups)? I tried this but it didn't work:
Code:
<vb:if condition="($bbuserinfo['groupid'] <> 2) "> |
Where are you trying to use this conditional?
|
I want to use it in the footer template.
My site uses a floating tool bar. For members that want to hide the tool bar all together, I want to allow them to add themselves to the social group, "Hide Tool Bar". I then want to use the conditional to hide the tool bar code if the user is a member of this social group. |
Quote:
Luckily however vBulletin has a built in feature, publicly joinable usergroups that should work exactly as you describe. In your Usergroup manager in Admin CP, make a new usergroup based off of registered users. Set the option to make it a publicly joinable usergroup. Call it "Hidden Toolbar" or whatever. Members can join it via the User CP -> Group Memberships And then you can use the standard condition: Code:
<vb:if condition="is_member_of($bbuserinfo, X)"> OR... now that I've typed that out... The "right" way of doing this would be using a Custom Profile Field. In Admin CP make a New Custom Profile Field... Basically a "Yes/No" option to turn on/off the toolbar... Then you would use a condition like: Code:
<vb:if condition="$bbuserinfo['fieldX'] == 'Yes' "> I can give you more details on this if you think it will work for your needs. |
I used the custom profile field solution. Thank you so much!!!!
|
Is there a conditional to use if one would like to show something only to the member who posted the post?
For example: I created a custom field that I would like for the member to enter information into that s/he and the admin can see when posted, but no other members can see. (A secure field - if you will). Thanks, Kether |
You could do a condition to show code only to the user who posted it...
Code:
<vb:if condition="$bbuserinfo['userid'] == $post['userid']"> But you'd still need to make the extra field to hold the data and everything else needed to process it. The conditional is the easy part. |
Quote:
I will give you code a go. Thanks for your quick help. I appreciate it very much. Kether --------------- Added [DATE]1307976670[/DATE] at [TIME]1307976670[/TIME] --------------- Quote:
Well, I am still having trouble getting this to work. I guess I need a conditional to show a field only to the admin user group and the individual who posted the information. So, I use the following code to identify a field, but need help with the conditional to make it only be seen by the admin group and the individual who posted the information: <vb:if condition="$field['fieldid'] == 6"> Any suggestions? Thanks again. Kether |
The important thing about the conditional I gave you is it only works in posts/the postbit.
You could show it to admins OR the user who's viewing his own post with: Code:
<vb:if condition="($bbuserinfo['userid'] == $post['userid']) OR (is_member_of($bbuserinfo, 6))"> But the fact your mentioning fields makes me think this code isn't for the postbit. If you're using custom profile fields you can mark them as private to limit who sees them. |
Quote:
No actually, I am editing the SHOWENTRY template in vbadvanced dynamics. I have added custom fields and would like to specify who can see one or two specific private fields. Sorry I did not make that clear in the first place. The bit of code I put in my previous 'merged' post: <vb:if condition="$field['fieldid'] == 6"> Tells the forum to put the information in field 6 in that location in the SHOWENTRY. I want to wrap a conditional around it to only display the information in field '6' to the admin group and the person who actually posted the information in the first place. I believe it should be fairly simple to wrap a conditional around this conditional, but so far I have not been able to figure it out. Thanks for your response. Kether |
Quote:
Code:
<vb:if condition="$field['fieldid'] == 6 AND is_member_of($bbuserinfo, 6)"> Code:
<vb:if condition="$field['fieldid'] == 6 AND (is_member_of($bbuserinfo, 6) OR OTHER_CONDITION_HERE)"> |
Why, this code is now working for me on postbit_legacy template:
Code:
|
Quote:
Much appreciative, Kether |
Quote:
|
$post['onlinestatus'] is not working to :(
Can you help me how to register a variable for template? Or can I make something like, if POSTBIT A, else B?? Thank you! |
Unfortunately preregistering variables was never something I mastered, one of the big reasons I prefer VB 3.x over VB 4.x. I just try to avoid doing anything where I have to preregister.
This is the article that is supposed to help: https://vborg.vbsupport.ru/showthread.php?t=228078 I'm not sure what yo mean by POSTBIT A and B? |
Thank you!
|
what are the conditions so only friends can see...and yes logged in to see...
|
Quote:
Thank you! |
The only template $onlinestatus is used is postbit_onlinestatus.
postbit_legacy is a template, you wouldn't make a plugin on a template, you'd make a plugin on a hook. Some hooks are postbit_display_start and posbit_display_complete. There are many others of course but I'd imagine you'd need to make a plugin on one of them. |
Great! Thank you...
|
Hey Joe, if you are still reading this thread, I have an update and a question.
As I said, I posted at vbadvanced.com and finally got a response that helped a bit, but I haven't solved the complete issue. I am so close and was hoping if you see what I have you could offer a suggestion: SO, I have finally got the custom field to display to both the admin and the user who posted it. Now, I need an else statement that tells the forum to not display it to any one else. Here is what I have: Code:
<vb:if condition="$field['fieldid'] == 5 AND (is_member_of($bbuserinfo, 6) OR $bbuserinfo['userid'] == $entry['userid'])"> Any ideas? Thanks, Kether |
Quote:
Code:
<vb:if condition="$field['fieldid'] == 5 AND (is_member_of($bbuserinfo, 6) OR $bbuserinfo['userid'] == $entry['userid'])"> |
Quote:
I really appreciate your help. Wish I could get a response as fast in the vba site. :) Thanks, Kether ----------- I wonder if instead of editing a template, I should be editing a php file and putting the condition around a specific field ID. So, if that field ID is called, it will only be displayed to the conditions of the field. Not sure here.... just guessing. Thoughts? |
Editing the PHP wouldn't be of any help- any condition you can test in PHP you can test in the template.
The only part of your conditional I don't know off hand is $entry['userid']- I've never used it before so I don't know what data it's returning. In the template put this code: Code:
{vb:raw entry.userid} EDIT- Looking over your code are you sure it's $field['fieldid'] and not $entry['fieldid'] ? |
Quote:
$entry['userid'] - I believe is returning the user who posted the article. (But again- I am guessing as I copied what suggested.) I will work on it some more and post back anything I find. Thanks Joe!! Kether --------------- Added [DATE]1308935315[/DATE] at [TIME]1308935315[/TIME] --------------- Quote:
Not sure what to make of that as it is not a field id nor is it a user id. But it always placed it where i put that code. Kether |
Sorry man... VBA Dynamics is a commercial mod I just don't have access to so I don't know how it's designed or what fields may be available.
If there is a php hook available somewhere you could make a plugin with this code, it will print out all available fields for $entry and see if any of them match the userid. Code:
echo "<pre>"; |
All times are GMT. The time now is 10:19 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|