Need to hide or disable the buttons for settings and announcements


Home Forums Front End PM PRO Need to hide or disable the buttons for settings and announcements

This topic is: Resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #27153
    Rob Davis
    Participant

    Hello!

    To adapt the plugin to my specific usage scenario, I need to hide the front-end buttons for settings and announcements. Ideally, I would be able to do so for only certain user roles. I would appreciate any suggestions. Thank you!

    #27159
    Shamim Hasan
    Keymaster

    You can add following code in your theme’s (child theme’s if you are using) functions.php

    add_filter( 'fep_menu_buttons', function( $menu  ){
        unset( $menu['settings'], $menu['announcements']  );
        return $menu;
    }, 99);
    

    It will remove for all users. If you want to hide for certain role you can let me know from which role you want to hide.

    #27178
    Rob Davis
    Participant

    Thank you! This works perfectly. I have WP user roles named external-user-student and external-user-teacher. If possible, I would like to remove the front-end buttons for settings and announcements for both user roles.

    Best regards,
    Rob

    #27181
    Shamim Hasan
    Keymaster

    You can use following code instead

    add_filter( 'fep_menu_buttons', function( $menu  ){
        if ( array_intersect( [ 'external-user-student', 'external-user-teacher' ], wp_get_current_user()->roles ) ){
            unset( $menu['settings'], $menu['announcements']  );
        }
        return $menu;
    }, 99);
    
    #27197
    Rob Davis
    Participant

    Thank you very much! This was exactly what I needed.

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

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.