Hide Roles in Front End PM Pro Directory


Home Forums Front End PM PRO Hide Roles in Front End PM Pro Directory

This topic is: Not Resolved
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #21167
    Rasaki Onile-Ere
    Participant

    I would like to have the ability to hide specific roles from the Front End Directory.

    I want the ability to be able to add to the list of hidden roles. However, to start with, please hide all roles except the role ‘Member’ from the Front End PM Pro User Directory.

    Thank you.

    #21170
    Shamim Hasan
    Keymaster

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

    add_filter( 'fep_directory_arguments', function( $args ){
        $role_users_to_hide = array( 'subscriber', 'author' ); //here add as many as you want
    
        if ( isset( $args['role__not_in'] ) ) {
            $args['role__not_in'] = array_merge( $args['role__not_in'], $role_users_to_hide );
        } else {
            $args['role__not_in'] = $role_users_to_hide;
        }
    
        return $args;
    }, 99);
    

    change/add as many roles slug as you want in place of subscriber, author

    #21199
    Rasaki Onile-Ere
    Participant

    Hi,

    I think I have made an error; but I added the following code and I got the ‘white screen of death’.

    Please help me amend it.

    add_filter( 'fep_directory_arguments', function( $args ){
    $role_users_to_hide = array( 'subscriber', 'author',Admin', Customer', Event Contributor', Employee', Contributor', HR Manager', Shop Manager', Accounting Manager', Editor'); //here add as many as you want
    if ( isset( $args['role__not_in'] ) ) {
    $args['role__not_in'] = array_merge( $args['role__not_in'], $role_users_to_hide );
    } else {
    $args['role__not_in'] = $role_users_to_hide;
    }
    return $args;
    }, 99);

    #21202
    Shamim Hasan
    Keymaster

    You need to find role slug to use here.
    eg. Slug of Subscriber is subscriber (lower cased). So you need to find slug of your all roles. Also use quote in both side. Eg 'subscriber'

    #21209
    Rasaki Onile-Ere
    Participant

    Hi,

    Thanks for the prompt response.

    Where do we locate the slug from?

    Thanks,

    Rasaki

    #21212
    Rasaki Onile-Ere
    Participant
    This reply has been marked as private.
    #21215
    Shamim Hasan
    Keymaster

    Your code seems ok.
    Where you are adding this code?
    Please see your server error log to see what error it shows there.

    #21243
    Rasaki Onile-Ere
    Participant
    This reply has been marked as private.
    #21249
    Shamim Hasan
    Keymaster

    Make sure you have added after <?php tag. if still not work please enable debug (https://codex.wordpress.org/Debugging_in_WordPress) to see actual error message.

    Let me know.

    #21269
    Rasaki Onile-Ere
    Participant
    This reply has been marked as private.
    #21272
    Shamim Hasan
    Keymaster

    We cannot correct code blindly. Please enable debug (add define( 'WP_DEBUG', true ); in wp-config.php) to get actual error message.

    If you want you can send me your FTP and wordpress admin credentials using https://www.shamimsplugins.com/sensitive-information/ so that i can assist you to add this code in your website.

    #21342
    Rasaki Onile-Ere
    Participant
    This reply has been marked as private.
    #21345
    Shamim Hasan
    Keymaster

    This is not the plugin issue. This is issue with the custom code added later.
    Screen share support is not possible. You can give your website credentials or the functions.php file where you added this code so that i can check if you added in right place or not.

    As you are getting white screen of death it must be some error message. May be you have enable debug in wrong place.

    #21347
    Shamim Hasan
    Keymaster

    Or you can live chat with me.
    Please go to https://www.shamimsplugins.com/live-chat/ and see chat option in bottom right.
    This live chat option will be available for next 30 minutes.

Viewing 14 posts - 1 through 14 (of 14 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.