MyBB Community Forums

Full Version: Template's assistance (If user)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'd like to know how to do the following inside the profile template... If it's possible that is.

I'd like to check the username of the profile I'm viewing, so it'd be the equivalent of...

if ($username == "WhateverISet"){ Then execute my code here } 

Can this be achieved?
Thanks.
Use this: http://community.mybb.com/thread-31860.html

An example of using it can be:

<if $mybb->user['postnum'] = "50" then>Anything that goes here would be only view able by users with 50 posts or above.</if>
(2011-12-02, 04:56 AM)crazy4cs Wrote: [ -> ]Use this: http://community.mybb.com/thread-31860.html

An example of using it can be:

<if $mybb->user['postnum'] = "50" then>Anything that goes here would be only view able by users with 50 posts or above.</if>

Great! Perfect thanks.
There should be another = like this;
<if $mybb->user['postnum'] == "50" then>Anything that goes here would be only view able by users with 50 posts or above.</if>
(2011-12-02, 04:56 AM)crazy4cs Wrote: [ -> ]Use this: http://community.mybb.com/thread-31860.html

An example of using it can be:

<if $mybb->user['postnum'] = "50" then>Anything that goes here would be only view able by users with 50 posts or above.</if>

(2011-12-02, 10:15 AM)Yaldaram Wrote: [ -> ]There should be another = like this;
<if $mybb->user['postnum'] == "50" then>Anything that goes here would be only view able by users with 50 posts or above.</if>

You are using a '='/'==' symbol, not '>=' what is what you mentioned.
I know php operator "==" is "Equal" (like "===" is "Identical" etc.) but please to tell me what is the difference in this example between
<if $mybb->user['postnum'] = "50"
and
<if $mybb->user['postnum'] == "50"
?
Which is the correct version or when we can use "=" and when "==" ?
// Later Edit: I'm begginer Smile
(2011-12-02, 10:46 AM)MyBB Tuneup Wrote: [ -> ]I know php operator "==" is "Equal" (like "===" is "Identical" etc.) but please to tell me what is the difference in this example between
<if $mybb->user['postnum'] = "50"
and
<if $mybb->user['postnum'] == "50"
?

// Later Edit: I'm begginer Smile

http://howtocompute.org/web-development-...tatements/

Read Part #2.
(2011-12-02, 10:50 AM)Omar G. Wrote: [ -> ]http://howtocompute.org/web-development-...tatements/

Read Part #2.
Nice and clean demonstration.
I should use more often google Smile
Thank you !
(2011-12-02, 10:15 AM)Yaldaram Wrote: [ -> ]There should be another = like this;
<if $mybb->user['postnum'] == "50" then>Anything that goes here would be only view able by users with 50 posts or above.</if>
Sorry, one missed. Yes there should be two equal-to's in the statement.

(2011-12-02, 03:49 AM)networkforfun Wrote: [ -> ]Hi, I'd like to know how to do the following inside the profile template... If it's possible that is.

I'd like to check the username of the profile I'm viewing, so it'd be the equivalent of...

if ($username == "WhateverISet"){ Then execute my code here } 

Can this be achieved?
Thanks.

If you use PHP in Templates / Complex Templates or Template Conditionals plugin:
<if $memprofile['username'] == 'blah' then>
Your code here will be displayed if the profile owner's username is blah
</if>