Log in

View Full Version : Postbit conditional based on profile field


thisgeek
05-24-2006, 08:19 AM
I'm probably using the wrong approach with what I'm trying to do:

I've added some custom profile fields and have them displayed on the postbit. Now, I would like to give users the option of turning the display of these fields off when they view threads.

To enable the choice, I've created a user profile field of type Single Selection Radio buttons, with the values of 'Yes' and 'No', the question being "Do you wish to display blah". The field name is field25.

In the postbit template, I want to surround my custom field display code with an if conditional that applies to the user viewing the page, and does not apply to the post, but I can't figure out quite how to do that.

I've tried:


<if condition="$bbuserinfo['field25'] == Yes"> Custom code goes here</if>


and I've tried:


<if condition="$userinfo['field25'] == Yes">Custom code goes here</if>


Neither of those methods work.

I've even tried just printing out the value of field25 by using displaying it without any if conditionals ($userinfo[field25]) but it is empty.

What am I doing wrong?

Boofo
05-24-2006, 08:25 AM
Try:


<if condition="$post['field25'] == 'Yes'">Custom code goes here</if>

thisgeek
05-24-2006, 08:45 AM
But surely the $post variable applies only to a particular user's post?
It won't have an effect on the person actually viewing the thread.
So, if *I* set the option to No, only my own posts would not display the code, and nobody would be able to see it, despite the setting in their profile.

I'm not sure if I'm getting my concept across correctly. I want my field25 code to behave similarly to the users own 'show signature' option. That is, if I set View Signatures to YES in my own profile, then I can see everybody's sigs on their posts. If I set it to NO in my profile, then I can't see anybody's sigs in their posts.

Boofo
05-24-2006, 10:11 AM
Then use postinfo instead of post.

peterska2
05-24-2006, 03:05 PM
<if condition="$bbuserinfo[field25]=='Yes'">Code</if>

Make sure that the yes is exactly the same as in the profile field, ie capitalisation.

If it doesn't work, let me know and I'll have another look at it when I have more time later tonight.