From 951d084b015bcb86019180d270297efaae635b2e Mon Sep 17 00:00:00 2001 From: nickw Date: Fri, 18 Feb 2011 18:42:09 +0000 Subject: Adding plugin hooks for authorization and login events. git-svn-id: http://code.elgg.org/elgg/trunk@8289 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/twitterservice/twitterservice_lib.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mod/twitterservice/twitterservice_lib.php') diff --git a/mod/twitterservice/twitterservice_lib.php b/mod/twitterservice/twitterservice_lib.php index bc9d28ec6..b3af18079 100644 --- a/mod/twitterservice/twitterservice_lib.php +++ b/mod/twitterservice/twitterservice_lib.php @@ -74,6 +74,9 @@ function twitterservice_login() { if ($users) { if (count($users) == 1 && login($users[0])) { system_message(elgg_echo('twitterservice:login:success')); + + // trigger login hook + elgg_trigger_plugin_hook('login', 'twitterservice', array('user' => $users[0])); } else { system_message(elgg_echo('twitterservice:login:error')); } @@ -153,6 +156,9 @@ function twitterservice_login() { // login new user if (login($user)) { system_message(elgg_echo('twitterservice:login:success')); + + // trigger login hook for new user + elgg_trigger_plugin_hook('first_login', 'twitterservice', array('user' => $user)); } else { system_message(elgg_echo('twitterservice:login:error')); } @@ -242,6 +248,9 @@ function twitterservice_authorize() { elgg_set_plugin_user_setting('twitter_name', $token['screen_name']); elgg_set_plugin_user_setting('access_key', $token['oauth_token']); elgg_set_plugin_user_setting('access_secret', $token['oauth_token_secret']); + + // trigger authorization hook + elgg_trigger_plugin_hook('authorize', 'twitterservice', array('token' => $token)); system_message(elgg_echo('twitterservice:authorize:success')); forward('pg/settings/plugins', 'twitterservice'); -- cgit v1.2.3