我想知道是否有人知道一个插件或一种通过编程更改特定用户/角色的默认管理页面的方法?
我有一个插件的主面板页面,当前设置了自定义角色和权限,可以使用Members Plugin 并希望强制这些自定义角色的用户将“我的主控制面板”用于其仪表板,因为他们不一定需要访问仪表板。
Minor Edit: 在更改角色的默认仪表板的同时,是否有方法禁用WordPress仪表板?
-扎克
我想知道是否有人知道一个插件或一种通过编程更改特定用户/角色的默认管理页面的方法?
我有一个插件的主面板页面,当前设置了自定义角色和权限,可以使用Members Plugin 并希望强制这些自定义角色的用户将“我的主控制面板”用于其仪表板,因为他们不一定需要访问仪表板。
Minor Edit: 在更改角色的默认仪表板的同时,是否有方法禁用WordPress仪表板?
-扎克
在主题的函数中。php:
function hide_the_dashboard()
{
global $current_user;
// is there a user ?
if ( is_array( $current_user->roles ) ) {
// substitute your role(s):
if ( in_array( \'custom_role\', $current_user->roles ) ) {
// hide the dashboard:
remove_menu_page( \'index.php\' );
}
}
}
add_action( \'admin_menu\', \'hide_the_dashboard\' );
function your_login_redirect( $redirect_to, $request, $user )
{
// is there a user ?
if ( is_array( $user->roles ) ) {
// substitute your role(s):
if ( in_array( \'custom_role\', $user->roles ) ) {
// pick where to redirect to, in the example: Posts page
return admin_url( \'edit.php\' );
} else {
return admin_url();
}
}
}
add_filter( \'login_redirect\', \'your_login_redirect\', 10, 3 );
使用Theme My Login 插件。
该插件根据您当前的主题设置WordPress登录、注册和放弃密码页面的主题。它创建了一个页面来代替wp登录。php,使用主题中的页面模板。还包括用于侧栏登录的小部件。
Features
广告仪表板:您可以检查$\\u请求,根据您得到的结果,只需使用wp_redirect();