Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: nVee on October 03, 2012, 08:05:46 AM

Title: How to determine if the logged in user is an administrator
Post by: nVee on October 03, 2012, 08:05:46 AM
My client wants me to do a simple modification to the Post.template.php where if they (administrator) create a new post they want an option where if they tick a checkbox it will send the entire mailinglist an email to notify them of the new topic. I am not sure if there is already a feature like this (if there is, please share with me). I have already modified the template to show the checkbox, the only problem is I cannot determine the usertype. I did a print_r($_SESSION); but it does not contain any user level information or anything I can work with.

Is there another way to determine if the user is an administrator?
Title: Re: How to determine if the logged in user is an administrator
Post by: Shambles on October 03, 2012, 08:24:19 AM
Try

if ($context['user']['is_admin']) ...
Title: Re: How to determine if the logged in user is an administrator
Post by: nVee on October 03, 2012, 08:36:04 AM
Hi5's all around!
Title: Re: How to determine if the logged in user is an administrator
Post by: Shambles on October 03, 2012, 08:38:43 AM
Or you could simply use the built in "announce" feature :D
Title: Re: How to determine if the logged in user is an administrator
Post by: nVee on October 03, 2012, 09:41:25 AM
Well that sounds like a awesome way :) I had a quick look through but cannot find where it is. How does it work?
Title: Re: How to determine if the logged in user is an administrator
Post by: Shambles on October 03, 2012, 09:49:20 AM
While creating a topic, open the "attachments and other options" doodaa below the post, and tick the "Announce topic" option.

You'll soon see what it does  8)