Home Forums WoodMart support forum User permissions for METABOXES of pages and posts

User permissions for METABOXES of pages and posts

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #513572

    staffcreator
    Participant

    Hello lads
    quick info..

    I would like the metabox setting option not to be visible on new pages or for new articles (See Attached Screen) for other User Roles.

    I would like the page settings to be visible only to administrators.

    I noticed that this theme option is also visible to other User Roles.. Such as, Contributor, Subscriber etc… ..

    (in reality it would be logical to show this option ONLY to site administrators and not to all user roles, because it modifies some graphic parts of the theme)

    I would like it to be seen ONLY for administrators.

    Is it possible to do something?

    Let me know
    Thank you guys!

    I’ll wait for you here.

    Greetings

    Attachments:
    You must be logged in to view attached files.
    #513997

    Hung Pham
    Keymaster

    Hi staffcreator,

    Thanks for reaching to us and appreciate your patience.

    I’ve sent your request to our developers. This topic will be discussed.

    Regards,

    • This reply was modified 1 year, 3 months ago by Hung Pham.
    #514020

    Hung Pham
    Keymaster

    Hi staffcreator,

    Please add below Custom Code to functions.php file in Child theme.

    The metaboxes are not displayed unless the user is logged in as an admin

    add_action( 'init', function () {
    	$user = wp_get_current_user();
    
    	if ( empty( $user->roles ) || ! in_array( 'administrator', $user->roles, true ) ) {
    		remove_action( 'init', 'woodmart_register_page_metaboxes', 100 );
    		remove_action( 'init', 'woodmart_register_product_metaboxes', 100 );
    	}
    });

    Regards,

    #514729

    staffcreator
    Participant

    Hi Hung Pham

    Thank you very much for your help!

    Good job!

    I confirm that it works…

    You can close this ticket

    Greetings
    🙂

    #514745

    Hung Pham
    Keymaster

    Hi staffcreator,

    Glad to hear your issue has been resolved. Keep us in mind for future questions and concerns, we’re always here to help!

    If you have a quick minute we always appreciate a 5-star rating on our theme!

    https://themeforest.net/item/woodmart-woocommerce-wordpress-theme/reviews/20264492

    Your feedback is the motivation to improve our work and services.

    Regards,

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘User permissions for METABOXES of pages and posts’ is closed to new replies.