Not Solved Template's assistance (If user)
#1
Not Solved
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.
Reply
#2
Not Solved
This user has been denied support. This user has been denied support.
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>
Reply
#3
Not Solved
(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.
Reply
#4
Not Solved
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>
Reply
#5
Not Solved
(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.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#6
Not Solved
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
Reply
#7
Not Solved
(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.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#8
Not Solved
(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 !
Reply
#9
Not Solved
This user has been denied support. This user has been denied support.
(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.

Reply
#10
Not Solved
(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>
XThreads App For MyBB: Link Directory, YouTube Gallery & etc - Full List
My Demo Site
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)