MyBB Hacks

Full Version: Template Conditionals
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11
Hello how can i do this

IF user is guest = showads

im trying to add a advetisement on the front page of the site, but i only want those who are not logged in to see it. if they logged in, do not display ad.

thanks!

and hi leefish <3
whats the latest version, thanks
is it possible using "Template Conditionals" to work with database into mybb templates?

for example i want to read all the values from fileld "number" from dbase table "test" and calculate and display the average value....
(07-10-2015 12:58 AM)xboris2010 Wrote: [ -> ]Hello how can i do this

IF user is guest = showads

Code:
<if !$mybb->user['uid'] then>blah</if>


(07-12-2015 08:37 PM)tempo Wrote: [ -> ]is it possible using "Template Conditionals" to work with database into mybb templates?
No, database queries are not considered a "safe" operation, so can only be done via PHP in Templates.
(07-14-2015 02:19 PM)ZiNgA BuRgA Wrote: [ -> ]
(07-10-2015 12:58 AM)xboris2010 Wrote: [ -> ]Hello how can i do this

IF user is guest = showads

Code:
<if !$mybb->user['uid'] then>blah</if>


Wouldn't that just show the code or text to a certain person on the forums? I think he wants to show it to a certain group.

Also, I just tried this on my forum and it showed it to me while I was logged in and logged out.

I was wondering how I would show a "verified" badge on that groups member profiles. Can you do that with this plugin?
(11-07-2015 03:37 AM)iamkristrammell Wrote: [ -> ]Wouldn't that just show the code or text to a certain person on the forums? I think he wants to show it to a certain group.

Guest "doesn't have" an uid.

(11-07-2015 03:37 AM)iamkristrammell Wrote: [ -> ]Also, I just tried this on my forum and it showed it to me while I was logged in and logged out.

Not quite sure how you applied it. I've just tested it and works for me.

(11-07-2015 03:37 AM)iamkristrammell Wrote: [ -> ]I was wondering how I would show a "verified" badge on that groups member profiles. Can you do that with this plugin?

You can use usergroup
(11-07-2015 04:16 AM)RateU Wrote: [ -> ]You can use usergroup

Would it be like:

Code:
<if !$mybb->usergroup['gid'] then>blah</if>


Sorry, I'm not very good with php yet. If that's not right could you give me an example?

In member_profile template, right?

You need to use $memprofile['usergroup']

For example:

Code:
<if $memprofile['usergroup'] == 4 then>blah</if>

I can use that multiple times right and what about if I want to use it on say the index or another page? By multiple times I mean that I can show multiple things on a single profile if they are in multiple groups.
(11-07-2015 04:58 AM)iamkristrammell Wrote: [ -> ]I can use that multiple times right and what about if I want to use it on say the index or another page?

Some areas have its own data array (for example, the $memprofile applied in user profile for the profile owner). You use $mybb->user for the viewer.
Pages: 1 2 3 4 5 6 7 8 9 10 11
Reference URL's