vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

kether1 06-12-2011 06:19 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2206755)
You could do a condition to show code only to the user who posted it...

Code:

<vb:if condition="$bbuserinfo['userid'] == $post['userid']">
(will work in the postbit)


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.

Thanks Joe. I was able to create the extra field, just couldn't figure out how to show it's contents only to the member who posted and admin instead of everyone who could see the post.

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:

Originally Posted by kether1 (Post 2206759)
Thanks Joe. I was able to create the extra field, just couldn't figure out how to show it's contents only to the member who posted and admin instead of everyone who could see the post.

I will give you code a go. Thanks for your quick help. I appreciate it very much.

Kether


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

BirdOPrey5 06-13-2011 06:17 PM

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))">
Where 6 is the usual usergroup for admins.

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.

kether1 06-13-2011 06:29 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2207239)
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))">
Where 6 is the usual usergroup for admins.

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.


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

BirdOPrey5 06-13-2011 06:42 PM

Quote:

Originally Posted by kether1 (Post 2207245)
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

Well this will limit it to administrators but I would have no way of knowing the conditional vbadvanced dynamics might use to know which user posted it- that would be a question better asked at their own forums- they'll know what's possible with their product.

Code:

<vb:if condition="$field['fieldid'] == 6 AND is_member_of($bbuserinfo, 6)">
The combined code, assuming you can find a conditional from vb advanced would be something like:

Code:

<vb:if condition="$field['fieldid'] == 6 AND (is_member_of($bbuserinfo, 6) OR OTHER_CONDITION_HERE)">

Bisha 06-13-2011 07:38 PM

Why, this code is now working for me on postbit_legacy template:

Code:

       
          <vb:if condition="$onlinestatus==1">Online</vb:if>
          <vb:if condition="$onlinestatus==0">Offline</vb:if>
          <vb:if condition="$onlinestatus==2">Privat</vb:if>

I get only OFFLINE :S even the user is online.

kether1 06-13-2011 07:51 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2207253)
Well this will limit it to administrators but I would have no way of knowing the conditional vbadvanced dynamics might use to know which user posted it- that would be a question better asked at their own forums- they'll know what's possible with their product.

Code:

<vb:if condition="$field['fieldid'] == 6 AND is_member_of($bbuserinfo, 6)">
The combined code, assuming you can find a conditional from vb advanced would be something like:

Code:

<vb:if condition="$field['fieldid'] == 6 AND (is_member_of($bbuserinfo, 6) OR OTHER_CONDITION_HERE)">

Thanks again. I have posted for help at vbadvanced, but no one has replied over there. I just replied to myself there with your suggestion so maybe that will encourage someone to offer up the missing bit of code. Still looking.

Much appreciative,
Kether

BirdOPrey5 06-13-2011 10:28 PM

Quote:

Originally Posted by Bisha (Post 2207276)
Why, this code is now working for me on postbit_legacy template:

Code:

       
          <vb:if condition="$onlinestatus==1">Online</vb:if>
          <vb:if condition="$onlinestatus==0">Offline</vb:if>
          <vb:if condition="$onlinestatus==2">Privat</vb:if>

I get only OFFLINE :S even the user is online.

Try using $post['onlinestatus'] instead of $onlinestatus. Not sure it's the same data but I can see $onlinestatus is never used in the postbit template so if $post['onlinestatus'] doesn't work you'll need to make a plugin to register $onlinestatus in the postbit.

Bisha 06-14-2011 08:58 AM

$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!

BirdOPrey5 06-14-2011 11:05 AM

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?

Bisha 06-14-2011 04:32 PM

Thank you!


All times are GMT. The time now is 06:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01656 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete