Show directory conditionally


Home Forums Front End PM PRO Show directory conditionally

This topic is: Resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #43194
    eugenie.oomes
    Participant

    Hi Shamim, as discussed in email: How can I show the directory front-end for another role besides admin, but not for anyone else?

    #43197
    Shamim Hasan
    Keymaster

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

    add_filter( 'fep_current_user_can', function( $can, $cap, $id ){
        if ( 'access_directory' != $cap || ! is_user_logged_in() || fep_is_user_blocked() ) {
    	return $can;
        }
        if( array_intersect( [ 'administrator', 'editor' ], wp_get_current_user()->roles ) ){
            return true;
        }
        return false;
    }, 10, 3);
    
    #43202
    eugenie.oomes
    Participant

    Perfect! Thanks Shamim!

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