IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#33699 - 10/26/10 01:18 PM Detect admin in PHP
RandomPHPDev Offline
OL Newbie

Registered: 09/20/10
Posts: 17
Hi

(EDITED)
1. In the template PHP file, is there a convenient way to detect if the user is logged in as administrator?

2. Similarily, is there a way to render the user's profile email address, in the template PHP?

My worse case solution for 1 is use javascript to scan the "generate userinfo" output, I'd like to avoid that route =).

thx!


Edited by RandomPHPDev (10/26/10 02:15 PM)

Top
#33700 - 10/26/10 01:48 PM Re: Detect admin in PHP [Re: RandomPHPDev]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
RandomPHPDev,

Here may not be the best place for php-specific questions. While PSW uses php, this isn't really a php development forum, and php development is not covered by our support service.

The best place to look for information specific to php is probably Google. If someone knows the answer to your question, they might post it here, but it's better to look for an answer on places like Google.

Regards,
Raphaël Lalonde Lefebvre

Top
#33701 - 10/26/10 02:12 PM Re: Detect admin in PHP [Re: Raphael Lalonde Lefebvre]
RandomPHPDev Offline
OL Newbie

Registered: 09/20/10
Posts: 17
Okay well it's not really a PHP question... it's a question about detecting who is currently logged-in when using a custom template for PrintShop Mail Web. The custom templates are PHP.

I'll take it as a 'no' then, hehe.

Looks like worst-case option then, using Javascript to scan the div containing the userinfo. If the Javascript finds the term 'administrator', then I will show the special administrator content seperate from other logged-in users. Because it's a client-side solution this creates issues with passing data and security. Ideally one should be able to know if someone is logged-in (as administrator) in PHP. Also, the javascript will break if the administrator name changes =).


Edited by RandomPHPDev (10/26/10 02:14 PM)

Top
#33702 - 10/26/10 11:13 PM Re: Detect admin in PHP [Re: RandomPHPDev]
Spot Print Offline
OL Newbie

Registered: 10/17/10
Posts: 3
RandomPHPDev,

To check for an admin:

$user_is_admin = ($_SESSION['User']['fnRoleID'] == 1);

to get the email:

$user_email = $_SESSION['User']['fcEmailAddress'];

Top