diff --git a/ChangeLog b/ChangeLog index a6d6c30432..2c30631ce2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ phpMyAdmin - ChangeLog - bug #4200 Missing syntax highlighting - bug #4201 Exports are not compressed - bug #4131 Import: "number of rows to skip" is ambiguous +- bug #4205 Add a user shows additional "edit user group" link 4.1.2.0 (2013-12-23) - bug #4178 Quick edit for BIT type does not work diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 86aa339f50..4169bc2906 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -2249,6 +2249,23 @@ function PMA_getUserGroupEditLink($username) . ''; } +/** + * Returns number of defined user groups + * + * @return integer $user_group_count + */ +function PMA_getUserGroupCount() +{ + $user_group_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) + . '.' . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']); + $sql_query = 'SELECT COUNT(*) FROM ' . $user_group_table; + $user_group_count = $GLOBALS['dbi']->fetchValue( + $sql_query, 0, 0, $GLOBALS['controllink'] + ); + + return $user_group_count; +} + /** * This function return the extra data array for the ajax behavior * @@ -2271,6 +2288,11 @@ function PMA_getExtraDataForAjaxBehavior( } } + $user_group_count = 0; + if ($GLOBALS['cfgRelation']['menuswork']) { + $user_group_count = PMA_getUserGroupCount(); + } + $extra_data = array(); if (strlen($sql_query)) { $extra_data['sql_query'] @@ -2330,7 +2352,7 @@ function PMA_getExtraDataForAjaxBehavior( . PMA_getUserEditLink($username, $hostname) . '' . "\n"; - if (isset($cfgRelation['users']) && isset($cfgRelation['usergroups'])) { + if (isset($cfgRelation['menuswork']) && $user_group_count > 0) { $new_user_string .= '