Skip to content

Instantly share code, notes, and snippets.

@jonleverrier
Last active December 12, 2018 17:21
Show Gist options
  • 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 ([email protected])
* @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