vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Problem with conditionals (https://vborg.vbsupport.ru/showthread.php?t=196981)

dismas 11-23-2008 01:52 AM

Problem with conditionals
 
In my postbit template, I have:
Code:

        <if condition="is_member_of($bbuserinfo, 5,6,7,15)">
              <div>
                  <if condition="$post['field5']">
                      a.k.a.: $post[field5]
                  </if>
              </div>
        </if>

Usergroup 15 is a club member's only usergroup. Basically, when someone joins the club, I add them to a subscription which puts them in 15 as the primary and 2 (Registered Users) as the additional usergroup. I'd like this to be visible to members of 15 but not those who are only in 2.

So do I have to change the way my subscription is set up or the way I have the if condition set up?

Dismounted 11-23-2008 02:49 AM

That conditional will not match those who are only in 2, so you do not have to change it.

dismas 11-23-2008 03:42 AM

But it's not showing up for those who are primarily in 15 and additionally in 2. And that's what I want.

Let me say it another way and maybe it will be more clear.

The way I want it and the way I thought it would work:
Club members with a subscription who are in 15 and 2 - see this field
Regular users who are only in 2 - don't see it

The way it is now:
Club members who are in 15 and 2 - don't see it <-- bad
Regular users who are only in 2 - don't see it <--good

Lynne 11-23-2008 05:05 PM

Can members in group 5,6,7 see it? Is your condition perhaps inside of another condition that members in group 15 don't get to see?

dismas 11-23-2008 11:29 PM

It works for 6 (me) and 7. Just not 15. And it's not inside another condition.

Dismounted 11-24-2008 04:16 AM

If you remove the "$post['field5']" conditional (the second one), does it still not show for the other group?

dismas 11-24-2008 05:08 AM

If I remove that, all group 15 sees is "a.k.a.:" but it doesn't show the value in field5. Group 6 sees both the aka and the value in the field.

This is what I have now:

Code:

        <if condition="is_member_of($bbuserinfo, 5,6,7,15)">
              <div>
               
                      a.k.a.: $post[field5]
                 
              </div>
        </if>


Dismounted 11-24-2008 09:57 AM

That means "field5" is not populated for group 15 - fill in that field for the user.

dismas 11-24-2008 11:27 AM

It is filled in in many user's profiles. It's an optional profile field.

Dismounted 11-25-2008 05:06 AM

Are you sure it is field 5? Because none of the conditionals are wrong - they are working.

dismas 11-25-2008 07:57 AM

Quote:

Originally Posted by Dismounted (Post 1672504)
Are you sure it is field 5?


Certain.

dismas 12-17-2008 09:03 AM

So, I'm still trying to figure out why this doesn't work...

I want this profile field to show in the postbit to those who are a member of both usergroups 2 and 15. No matter what group the poster is in.

Now I'm trying variations on a theme. I tried doing this but I don't know if it's even possible:

Code:

<if condition="is_member_of($bbuserinfo, 2) AND is_member_of($bbuserinfo, 15)">
    <div>
        <if condition="$post['field5']">
            a.k.a.: $post[field5]
        </if>
    </div>
</if>

It doesn't return any errors when I save it but it also does not show the profile field to those members. Can an "AND" be used in this fashion?

Dismounted 12-17-2008 10:02 AM

Code:

<if condition="is_member_of($bbuserinfo, 2) AND is_member_of($bbuserinfo, 15)">
Is the same as:
Code:

<if condition="is_member_of($bbuserinfo, 2, 15)">
(Note this only applies in this case, and does not apply to every function.)

SEOvB 12-17-2008 01:23 PM

Have you tried

Code:

<if condition="(is_member_of($bbuserinfo, 2,15)) AND ($post[field5]) ">
a.k.a.: $post[field5]
</if>


Lynne 12-17-2008 02:10 PM

Quote:

Originally Posted by Dismounted (Post 1687268)
Code:

<if condition="is_member_of($bbuserinfo, 2) AND is_member_of($bbuserinfo, 15)">
Is the same as:
Code:

<if condition="is_member_of($bbuserinfo, 2, 15)">
(Note this only applies in this case, and does not apply to every function.)

I thought this:
Code:

<if condition="is_member_of($bbuserinfo, 2, 15)">
Is the same as this:
Code:

<if condition="is_member_of($bbuserinfo, 2) OR is_member_of($bbuserinfo, 15)">
At least, that is the way I've always used it. :confused:

Dismounted 12-18-2008 10:20 AM

My bad, Lynne. Late at night and not enough coffee. :)

I stand corrected.

dismas 12-19-2008 04:05 PM

Quote:

Originally Posted by FRDS (Post 1687332)
Have you tried

Code:

<if condition="(is_member_of($bbuserinfo, 2,15)) AND ($post[field5]) ">
a.k.a.: $post[field5]
</if>


As I understand it, that would mean that anyone who had filled out field 5 and was a member of UG #2 would see this. Which would mean that any regular user who filled out field 5 would be able to see everyone's field 5 entry. Right?

SEOvB 12-19-2008 04:09 PM

Quote:

Originally Posted by dismas (Post 1688862)
As I understand it, that would mean that anyone who had filled out field 5 and was a member of UG #2 would see this. Which would mean that any regular user who filled out field 5 would be able to see everyone's field 5 entry. Right?

It reads, if you are in usergroup 2 or 15, and the user has field 5 entered, it will show it to you.

If you aren't in usergroup 2 or 15 and the user has it entered, it wont show it to you

If you are in usergroup 2 or 15 and the user doesn't have field 5 entered, it shows nothing


So you probably just want the usergroup ID of 15 there (and not 2), and the field5

dismas 12-19-2008 04:33 PM

Quote:

Originally Posted by FRDS (Post 1688867)
It reads, if you are in usergroup 2 or 15, and the user has field 5 entered, it will show it to you.

My club members have 15 as primary and 2 as additional. It does not show for them. Is there a way to change that "or" to "and"?

Dismounted 12-20-2008 02:57 AM

Code:

<if condition="is_member_of($bbuserinfo, 2) AND is_member_of($bbuserinfo, 15) AND $post['field5'] ">
a.k.a.: $post[field5]
</if>


dismas 12-20-2008 11:20 PM

That doesn't work either.

Would you like to see my postbit template? Maybe I'm missing something...

dismas 02-17-2009 03:29 AM

I fixed this.

Under General Permissions within the Usergroup permissions, "Can View Private Custom Fields" has to be set to yes since the user's real name is a private field.


All times are GMT. The time now is 04:07 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
  • Page Generation 0.02560 seconds
  • Memory Usage 1,762KB
  • 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
  • (12)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete