Skip to content

Instantly share code, notes, and snippets.

@jonleverrier
Last active December 12, 2018 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonleverrier/358139ae1daa081710ca8f9bcf4b7399 to your computer and use it in GitHub Desktop.
Save jonleverrier/358139ae1daa081710ca8f9bcf4b7399 to your computer and use it in GitHub Desktop.
isAdmin snippet for MODX. returns the value 1 if the user is an administrator
<?php
/**
* isAdmin snippet
* returns the value 1 if the user is an administrator
*
* example usage: [[!isAdmin:is=`1`:then=`i'm an admin`:else=`i'm just a content editor`]]
*
* @author Jon Leverrier (jon@youandmedigital.com)
* @version 1.0
* @since 10th December 2017
*/
// name of user group
if ($modx->user->isMember('Administrator') ) {
return true;
} else {
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment