simple "if" condition

karev

Active member
hello community,im a really novice to oop php developpement but i try to verify if the post ID==1
i mean to verify if its the first post in a thread can someone help me please ??
 

James

Well-known member
In templates, arrays use the dot (.) operator.

Have you checked if $message has the array key post_id? I'll check in a second and get back to you.
 

SneakyDave

Well-known member
I think this works, to determine the first post position, assuming you want it in a xF template.
Code:
<xen:if is="{$post.position} == 0>
.. do something crazy ..
</xen:if>
 

karev

Active member
In templates, arrays use the dot (.) operator.

Have you checked if $message has the array key post_id? I'll check in a second and get back to you.
i just give example i dont know if its correct okey i'll delete the example to not confuse people XD
 

James

Well-known member
A simple workaround (from a quick 5sec glance) would be to add another condition to the if ($visitor['user_id'] <= 0)

Something like: if (($visitor['user_id'] <= 0) && ($message['post_id'] == '1'))
 

SneakyDave

Well-known member
There's an error in that if, a missing parenthesis I think....
Code:
if (($visitor['user_id'] <= 0) && ($message['post_id'] == '1'))
 

EQnoble

Well-known member
Basically you want unregistered users to not be able to view the contents of the original post unless they are logged in with permissions right?
 

karev

Active member
Basically you want unregistered users to not be able to view the contents of the original post unless they are logged in with permissions right?
i want that visitor cant see the link in the first post of the thread ,only link in first post
 

Ajaxboy

Active member
Well first you gotta get the thread object then, you gotta go from there..

If you are novice, I would not recommend editing things as it could brake something. But otherwise, post what you have and will try to point you on the right path..
 
Top