Log in

View Full Version : Problem with conditionals


dismas
11-23-2008, 01:52 AM
In my postbit template, I have:

<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:


<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
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:


<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
<if condition="is_member_of($bbuserinfo, 2) AND is_member_of($bbuserinfo, 15)">
Is the same as:
<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


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

Lynne
12-17-2008, 02:10 PM
<if condition="is_member_of($bbuserinfo, 2) AND is_member_of($bbuserinfo, 15)">Is the same as:
<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:
<if condition="is_member_of($bbuserinfo, 2, 15)">

Is the same as this:
<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
Have you tried


<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
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
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
<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.