Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of icepin
    icepin
    Participant

    @icepin

    nevermind…

    Avatar of icepin
    icepin
    Participant

    @icepin

    Based on David Carson’s snippet for making the website available only for users, came up with this and it does the job for me so…. maybe others will find it useful:

    // Declare Ban Users by Role function
    function ban_user(){
    global $bp, $bp_unfiltered_uri;

    // If user is logged in and
    if (is_user_logged_in() &&
    (
    // The current user role is banned
    current_user_can('banned')
    )

    ) {
    // Display the error message
    wp_die('You are banned.');
    }
    }

    add_action( 'wp', 'ban_user', 3 );

Viewing 2 replies - 1 through 2 (of 2 total)