Support » Plugin: Visual Editor Custom Buttons » Quick fix for vecb_get_current_user_role()

  • Instead of

    //Get current user role
    function vecb_get_current_user_role() {
        global $current_user;
        get_currentuserinfo();
        $user_roles = $current_user->roles;
        $user_role = array_shift($user_roles);
        return $user_role;
    };
    //

    better use

    //Get current user role
    function vecb_get_current_user_role() {
        $current_user = wp_get_current_user();
        $user_roles = $current_user->roles;
        $user_role = array_shift($user_roles);
        return $user_role;
    };
    //

    as get_currentuserinfo() has been deprecated in WordPress 4.5.

    There are also some undefined index Notices, especially when adding a new button.

    Nevertheless I enjoy using this Plugin. Great work, thanks a lot!

    • This topic was modified 2 years, 8 months ago by  dspaete.
  • The topic ‘Quick fix for vecb_get_current_user_role()’ is closed to new replies.