Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change permission from admin on multisite in plugins code

Discussion in 'WordPress Multisite (MU)' started by henryk, Nov 11, 2017.

  1. henryk

    New Member

    Joined:
    Nov 11, 2017
    Messages:
    1
    Likes Received:
    0
    I have plugin, but there is problem with permission on multisite. How can I change permission from "administrator" to "current_user_loged_in" or multiple role "admin, editor,author..."

    Code:
      if ( array_key_exists( 'administrator', $current_user->caps ) ) {
                if ( array_key_exists( '_wpnonce', $_REQUEST ) ) {
                    $valid_nonce = wp_verify_nonce( $_REQUEST['_wpnonce'], 'frontend_category_management' );
                    if ( $valid_nonce ) {
                        if ( isset( $_POST['submit-cat-form'] ) ) {
                            if ( !empty( $_POST['newcategory'] ) ) {
                                $cat_ID = get_cat_ID( $_POST['newcategory'] );

    When I change it for:

    Code:
        if ( is_user_logged_in() ) {
                if ( array_key_exists( '_wpnonce', $_REQUEST ) ) {
                    $valid_nonce = wp_verify_nonce( $_REQUEST['_wpnonce'], 'frontend_category_management' );
                    if ( $valid_nonce ) {
                        if ( isset( $_POST['submit-cat-form'] ) ) {
                            if ( !empty( $_POST['newcategory'] ) ) {
                                $cat_ID = get_cat_ID( $_POST['newcategory'] );
    ... so I can add new, but I can´t edit, or delete.
     
    #1

Share This Page

Web Hosting