• Resolved Triner Media + Print

    (@trinermedia)


    I want to give a non-admin user access to certain admin-areas of PMS. With the solution described here, I could already implement this for the areas “Members”, “Payments” and “Reports”. However, for the “Subscription Plans” and “Discount codes” areas, I have not been able to make it work. I have extended the code for this as follows, but the last two areas remain locked for the non-admin user. Is there any way to extend these permissions?

    add_filter( 'pms_submenu_page_capability', 'pmsc_allow_editors_to_view_pages', 20, 2 );
    function pmsc_allow_editors_to_view_pages( $capability, $menu_slug ){    
      if( $menu_slug == 'pms-payments-page' || $menu_slug == 'pms-members-page' || $menu_slug == 'pms-reports-page' || $menu_slug == 'pms-export-page' || $menu_slug == 'edit.php?post_type=pms-subscription' || $menu_slug == 'edit.php?post_type=pms-discount-codes')        
        return 'pms_edit_capability';    
     
      return $capability;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support alexandrubodea

    (@alexandrubodea)

    Hi @trinermedia,

    At the moment this is not possible, but after we release our next update to PMS you will be able to achieve this with the following code:?

    add_filter( 'pms_submenu_page_capability', 'pmsc_allow_editors_to_view_pages', 20, 2 );
    add_filter( 'pms_custom_post_type_capability', 'pmsc_allow_editors_to_view_pages', 20, 2 );
    function pmsc_allow_editors_to_view_pages( $capability, $menu_slug ){
    
        $target_pages = array(
            'paid-member-subscriptions',
            'pms-payments-page',
            'pms-members-page',
            'pms-reports-page',
            'pms-export-page',
            'pms-subscription',
            'pms-discount-codes',
        );
    
        if( in_array( $menu_slug, $target_pages ) )
            return 'pms_edit_capability';
    
        return $capability;
    
    }

    Best regards,

    Thread Starter Triner Media + Print

    (@trinermedia)

    Hi @alexandrubodea

    These are great news! ?? I have just adopted the code and updated the plugin. It does not work yet. Is the update you mentioned still pending?

    Kind regards

    Plugin Support alexandrubodea

    (@alexandrubodea)

    The next update that I was referring to was not yet released. The next update to PMS will most likely be released next week.

    Best regards,

    Thread Starter Triner Media + Print

    (@trinermedia)

    I just updated to the latest version of your plugin and voilà, it works like you said. Thank you very much, @alexandrubodea ??

    Plugin Support alexandrubodea

    (@alexandrubodea)

    Glad to hear this!

    Have an amazing day!

    Best regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Allow editor or other user roles to manage subscription plans and discount codes’ is closed to new replies.