WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do I replace the 'Add New User' admin page? (4 posts)

  1. sontru
    Member
    Posted 1 year ago #

    I would like to replace the 'Add New User' admin page (user-new.php) with my own custom add new user page using a plugin. Any idea how I would do this?

    I am able to remove the 'Users' menu using:

    add_action( 'admin_menu', 'my_remove_menu_pages' );
    
    function my_remove_menu_pages() {
            remove_menu_page('users.php');
    }

    but I don't want to re-write all the sub menus and user functions along with it! I could do this and create my own users menu:

    add_action('admin_menu','my_users');
    
    function my_users () {
            add_menu_page('My Users','My Users','Administrator',__FILE__,'my_users_function');

    and add these functions back in, but how? Any help would be appreciated.

  2. Md Mahmudur Rahman
    Member
    Posted 1 year ago #

    You can do this by using the Admin Menu Editor plugin. This plugin will allow you to hide/show any menu or menu item. Also you can create a custom menus that point to any part of the Dashboard or an external URL.

    Here is the link:

    http://wordpress.org/extend/plugins/admin-menu-editor/

    Cheers.

  3. sontru
    Member
    Posted 1 year ago #

    Thanks guys,

    I've solved it with the following

    add_action( 'admin_menu', 'adjust_the_wp_menu');
    
    function adjust_the_wp_menu() {
      $page = remove_submenu_page( 'users.php', 'user-new.php' );
      add_users_page('My Users', 'Add New', 'administrator', __FILE__, 'my_user_page');
    }
    
    function my_user_page(){
            echo "HELLO";
    }

    (I don't know why my page appears as the bottom in the submenu list - is there a way of ordering the submenu items? I want my page menu item to be in the same position, 2, as the original Add New item.)

    I will check out the Admin Menu Editor plugin if I get unstuck again.

Topic Closed

This topic has been closed to new replies.

About this Topic