Created
August 12, 2011 16:32
-
-
Save brettp/1142415 to your computer and use it in GitHub Desktop.
Elgg plugin to count number of times a user has logged in
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 | |
/** | |
* Hook into the login, user event and increment the login count metadata. | |
* | |
* @param string $event | |
* @param string $type | |
* @param ElggUser $user | |
*/ | |
function login_count($event, $type, $user) { | |
$login_count = $user->login_count; | |
$login_count++; | |
$user->login_count = $login_count; | |
if ($login_count == 10) { | |
forward("url-to-forward-to"); | |
} | |
} | |
register_elgg_event_handler('login', 'user', 'login_count'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment