From 20e26a3920809b8abb163954743aaf0a5adf5271 Mon Sep 17 00:00:00 2001 From: Wardormeur Date: Sun, 4 Oct 2015 19:19:39 +0200 Subject: [PATCH 1/5] [ticket/14213] Adding event after users have been added to a group Allow mapping with others CMS by exposing user configuration & changes PHPBB3-14213 --- phpBB/includes/functions_user.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index fe370750d9..66da6503ae 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2754,6 +2754,18 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, } $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary); + /** + * Event after users are added to a group + * + * @event core.group_add_user_after + * @var int group_id ID of the group to which users are added + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are added + * @var array username_ary names of the users which are added + * @since 3.6 + */ + $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); } if (sizeof($update_id_ary)) From 2419f63aab8b1d164511e1688228ef8b11e2d515 Mon Sep 17 00:00:00 2001 From: Wardormeur Date: Sun, 4 Oct 2015 21:13:49 +0200 Subject: [PATCH 2/5] [ticket/14213] Adding missing reference to event dispatcher Required to dispatch event, wasn't included into global PHPBB3-14213 --- phpBB/includes/functions_user.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 66da6503ae..123a893f23 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2698,7 +2698,7 @@ function group_delete($group_id, $group_name = false) */ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false) { - global $db, $auth, $phpbb_container; + global $db, $auth, $phpbb_container, $phpbb_dispatcher; // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); @@ -2762,7 +2762,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, * @var string group_name Name of the group * @var array user_id_ary IDs of the users which are added * @var array username_ary names of the users which are added - * @since 3.6 + * @since 3.7 */ $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); From ffbc2d02d7920b093eeb852c41a82bf2c5b1bb21 Mon Sep 17 00:00:00 2001 From: Wardormeur Date: Tue, 6 Oct 2015 08:56:44 +0200 Subject: [PATCH 3/5] [ticket/14213] Fix version number for core.group_add_user_after event PHPBB3-14213 --- phpBB/includes/functions_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 123a893f23..b702deba55 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2762,7 +2762,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, * @var string group_name Name of the group * @var array user_id_ary IDs of the users which are added * @var array username_ary names of the users which are added - * @since 3.7 + * @since 3.1.7-RC1 */ $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); From e6d3ed55296a58db143ced87c58e6c4f95c31ae4 Mon Sep 17 00:00:00 2001 From: Wardormeur Date: Sun, 8 Nov 2015 12:16:41 +0100 Subject: [PATCH 4/5] [ticket/14213] Mv event group_add_user_after after cache cleaning In order to match with the rest of the event and to have appropriate info state PHPBB3-14213 --- phpBB/includes/functions_user.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index b702deba55..32205fb2e7 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2754,18 +2754,6 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, } $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary); - /** - * Event after users are added to a group - * - * @event core.group_add_user_after - * @var int group_id ID of the group to which users are added - * @var string group_name Name of the group - * @var array user_id_ary IDs of the users which are added - * @var array username_ary names of the users which are added - * @since 3.1.7-RC1 - */ - $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); - extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); } if (sizeof($update_id_ary)) @@ -2787,6 +2775,19 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, // Clear permissions cache of relevant users $auth->acl_clear_prefetch($user_id_ary); + /** + * Event after users are added to a group + * + * @event core.group_add_user_after + * @var int group_id ID of the group to which users are added + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are added + * @var array username_ary names of the users which are added + * @since 3.1.7-RC1 + */ + $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); + if (!$group_name) { $group_name = get_group_name($group_id); From d37d3ed3ed91cc16271c57ab7210c7c0aa19910b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 8 Dec 2015 15:32:45 +0100 Subject: [PATCH 5/5] [ticket/14213] Add pending to core.group_add_user_after PHPBB3-14213 --- phpBB/includes/functions_user.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 32205fb2e7..3e2dbcb794 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2783,9 +2783,16 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, * @var string group_name Name of the group * @var array user_id_ary IDs of the users which are added * @var array username_ary names of the users which are added + * @var int pending Pending setting, 1 if user(s) added are pending * @since 3.1.7-RC1 */ - $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + $vars = array( + 'group_id', + 'group_name', + 'user_id_ary', + 'username_ary', + 'pending', + ); extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); if (!$group_name)