News:

Wondering if this will always be free?  See why free is better.

Main Menu

Check if user is Paid subscription and redirect

Started by endomorph, November 30, 2010, 04:58:18 PM

Previous topic - Next topic

endomorph

How would I code to check if the member has a current paid subscription or is in the member group called "Supporting Member" and if not call a piece of javascript ?

Tyrsson

PM at your own risk, some I answer, if they are interesting, some I ignore.


spottedhog

Try this:

Quoteglobal $user_info, $context;

$groupID = 9;
if (in_array($groupID, $user_info['groups']) || $context['user']['is_admin'])

{
// some code here
} else {
// your javascript code
}

endomorph

Perfect !

Could you also explain to me what -

|| $context['user']['is_admin'])

does ?

Tyrsson

That code checks to see if the user is in the array groups by ID or that the user is an admin the || operator means "or" more or less.
PM at your own risk, some I answer, if they are interesting, some I ignore.


spottedhog

|| $context['user']['is_admin'])    ...so the Admins can see whatever code also, otherwise, only those in the specific membergroup would be able to view the code.

Advertisement: