plugins - Show function to super admin

How do I limit information being applied only to Network Administrators?TL;DR;I am building a multisite for a City Coun

How do I limit information being applied only to Network Administrators?

TL;DR; I am building a multisite for a City Council where every member will have its own subdomain. In one of the plugins, I want to limit some menu options to be shown only to the users with the network admin role.

I found this from almost 5 years ago but it doesn't work:

 <?php

function check_for_superAdmin($user_login, $user) {
    $current_user = get_userdatabylogin($user_login);
    if ( is_super_admin( $current_user->ID ) ) {
        // do these things 
    <?php if ( $purchase_code != '' ): ?>
        <small class="text-muted form-text">
           <?php printf(
                __( '<a class="%s" href="#">Click here</a> to dissociate this purchase code from the current domain (use to move the plugin to another site).', 'bookly' ), 'bookly-js-detach-pc'
            ) ?>
        </small>
    <?php endif ?>

        }
    else { // do other things 

    }
}
add_action( 'wp_login', 'check_for_superAdmin', 10, 2 );

?>

The idea is that only SuperAdmin can mess with the purchase code from Bookly (a non-GPL plugin) but I may reuse the code for other functions.

What do I need to change? What would be the best way to first check that the user has the network admin role?

Thanks,

AG

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742418571a4440220.html

相关推荐

  • plugins - Show function to super admin

    How do I limit information being applied only to Network Administrators?TL;DR;I am building a multisite for a City Coun

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信