Last active
January 12, 2016 07:32
-
-
Save itskingori/6586756 to your computer and use it in GitHub Desktop.
Log in a user programmatically in MODx, answer (hopefully) to a question posted in the forums here; http://forums.modx.com/thread/86714/is-it-possible-to-login-a-user-programmatically-in-frontend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id = 1; // just an example ... use appropriate id | |
$user = $this -> modx -> getObject('modUser', $id); | |
if (!$user -> hasSessionContext('web')) { | |
$user -> addSessionContext('web'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more flexibility I use: