PDA

View Full Version : Condition to show ONLY TO THREAD OWNER?


addamroy
12-11-2012, 01:34 PM
Is there a vbif condition to check if a user is the creator of the thread?

I want to put an ad on threads that show only to the user who started the thread.

Something like, <vbif condition=(user_started_thread)>This is your thread!</vbif> would be perfect :)

Is there something for this?

mokujin
12-11-2012, 01:53 PM
<vb:if condition="$thread['postuserid'] == $bbuserinfo['userid']">This is your thread</vb:if>
Not tested yet, but try it.

addamroy
12-11-2012, 04:16 PM
Didn't work :(

kh99
12-11-2012, 04:20 PM
Try $threadinfo instead of $thread.

addamroy
12-11-2012, 05:05 PM
That didn't work either :(

mokujin
12-11-2012, 05:27 PM
Where did you put the code into?

addamroy
12-11-2012, 06:26 PM
I'm just using it in the "under navbar" advertisement slot right now.

Once I get the conditions to work there, I'm going to try integrating it elsewhere.

mokujin
12-11-2012, 06:55 PM
So, try it in SHOWTHREAD template, add this code
<vb:if condition="$thread['postuserid'] == $bbuserinfo['userid']">This is your thread</vb:if>
or
<vb:if condition="$threadinfo['postuserid'] == $bbuserinfo['userid']">This is your thread</vb:if>
under {vb:raw navbar}

addamroy
12-11-2012, 07:54 PM
would that conditional work in one template and not another? Shouldn't it work anywhere if it was going to?

Basically I'm just going to put a link under the first post of threads (probably in the postbit_legacy template) in a certain forum, and only show it to whoever created the thread.

I'm just using this code inside the advertising spot to get it working in the first place, I can use other conditionals here just this one you provided isn't working. Nothing shows up at all.

Lynne
12-11-2012, 08:16 PM
Only variables that are registered for use in a template may be used in that template. So yes, it very much depends on what template you are going to be using the condition in. Try using $post in the postbit template instead of $thread or $threadinfo.

addamroy
12-12-2012, 01:05 AM
Thanks Lynne, definitely works in the showthread template :)

Will change it to $post instead of $thread when testing it in the postbit now.

Thanks guys!