Forked from itskingori/modx-programmatic-user-login.php
Created
January 12, 2016 07:32
-
-
Save eshleebien/ffbab4bee8a6a9c103d2 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 hidden or 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