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/33151101bad819739ad9751cbc37f476 to your computer and use it in GitHub Desktop.
Save jonleverrier/33151101bad819739ad9751cbc37f476 to your computer and use it in GitHub Desktop.
isAnon snippet for MODx. Returns the value 1 if the user is anonymous (not logged into the manager)
<?php
/**
* isAnon snippet
* returns the value 1 if the user is anonymous (not logged into the manager)
*
* example usage: [[!isAnon:is=`1`:then=``:else=`i'm not logged in`]]
*
* @author Jon Leverrier (jon@youandmedigital.com)
* @version 1.0
* @since 10th December 2017
*/
if ($modx->user->hasSessionContext('mgr') ) {
return true;
} else {
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment