Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commmit - admin menu slugs changed for non-super-admins.

  • Loading branch information...
commit 9ffe338c50f3ee055de477ae2a07b2c3d9580b5e 0 parents
@thenbrent authored
Showing with 37 additions and 0 deletions.
  1. +37 −0 avatars-site-admin-fix.php
37 avatars-site-admin-fix.php
@@ -0,0 +1,37 @@
+<?php
+/*
+Plugin Name: Avatars Site Admin Fix
+Description: Allow site admins to change avatars of users on their site with the IncSub Avatars plugin.
+Author: _FindingSimple
+Author URI: http://findingsimple.com/
+Version: 1.0
+Network: true
+*/
+
+/**
+ * When the current user is not a super admin, expose the Avatars class's administration
+ * menus to be standard administrators via the site options pages.
+ **/
+function gsa_change_avatar_url(){
+ global $ms_avatar;
+
+ if( is_object( $ms_avatar ) && !is_super_admin() ){
+ $ms_avatar->network_top_menu = 'options-general.php';
+ $ms_avatar->network_top_menu_slug = 'options-general.php';
+ }
+}
+add_action( 'init', 'gsa_change_avatar_url' );
+
+/**
+ * Don't include the Edit Avatar admin page in the menu.
+ **/
+function gsa_remove_avatar_url(){
+ global $ms_avatar, $submenu;
+
+ if( is_object( $ms_avatar ) && !is_super_admin() ){
+ add_options_page( __( 'Edit User Avatar', 'avatars' ), __( 'Edit User Avatar', 'avatars' ), 'edit_users', 'edit-user-avatar', array( &$ms_avatar, 'page_site_admin_edit_user_avatar' ) );
+ $key = $ms_avatar->array_find_r( 'edit-user-avatar', $submenu );
+ unset( $submenu['options-general.php'][$key] );
+ }
+}
+add_action( 'admin_menu', 'gsa_remove_avatar_url' );
Please sign in to comment.
Something went wrong with that request. Please try again.