• I am trying to allow non-admins access to the settings page of the “Responsive Full Width Slider” plugin.

    this advice seemed not to work: https://www.ads-software.com/support/topic/how-to-allow-non-admins-editors-authors-to-use-certain-wordpress-plugins?replies=3

    as there was only one instance of “manage_options” and it wasn’t in the context they said. I tried changing that to edit_pages anyway, and it didn’t work.

    Then I found a few instances of “if(is_admin())” and I changed that to “if (current_user_can (‘edit_pages’) )

    Again, no results. Using the plugin User Role Editor, I added every single capability to a role and it still wouldn’t let me into this plugin. It’s a multisite install and I tried installing it on specific pages instead of network-wide… nothing.

    Any idea what this could be? only other bit of code that seems to control permissions would be this one, and I can’t figure why members with edit_post capabilities would be stopped by it:

    // check permissions
      if (!current_user_can('edit_post', $post_id))
        return;
    
            $old['rsris_slide'] = get_post_meta( $post_id, 'rsris_slide', true );
            $new['rsris_slide'] = $_POST['rsris_slide'];
    
            if ( $new['rsris_slide'] && $new['rsris_slide'] != $old['rsris_slide'] ) {
              update_post_meta($post_id, 'rsris_slide', $new['rsris_slide']);
            } elseif ( '' == $new['rsris_slide'] && $old['rsris_slide'] ) {
              delete_post_meta($post_id, 'rsris_slide', $old['rsris_slide']);
            }

    this is where it adds to the menu, I have already changed if(is_admin()) to if(current_user_can(‘edit_pages’)

    function rfwbs_frontend_script(){
    	if(!current_user_can('edit_pages')){
    		wp_enqueue_script('jquery');
    		wp_enqueue_script('rfwbs-easing', plugins_url('js/jquery.easing.1.3.js', __FILE__ ),array('jquery'),'',1 );
    		wp_enqueue_script('rfwbs-animate', plugins_url('js/jquery.animate-enhanced.min.js', __FILE__ ),array('jquery'),'',1  );
    		wp_enqueue_script('rfwbs-superslides', plugins_url('js/jquery.superslides.js', __FILE__ ),array('jquery'),'',1  );
    		wp_enqueue_style('rfwbs-front-style',plugins_url('css/rfwbs_slider.css',__FILE__));
    	}
    }
    
    // 'ADMIN_MENU' FOR ADDING MENU IN ADMIN SECTION
    add_action('admin_menu', 'rfwbs_plugin_admin_menu');
    function rfwbs_plugin_admin_menu() {
        add_menu_page('Customize Background', 'Background Images','administrator', 'rfwbs_slider', 'rfwbs_backend_menu',plugins_url('inc/images/rfwbs-icon.png',__FILE__));
    }

  • The topic ‘allowing non-admin to change plugin settings-RFWBS slider’ is closed to new replies.