Forked from strangerstudios/my_pmpro_iflychat_check_access_filter.php
Created
April 5, 2017 07:11
-
-
Save andrewlimaza/a6dcea937d6d2453f0d11febef9c3a50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Load iFlyChat Support or Chatroom for Members in Level 1 and 2 Only | |
* Update line 11 with your Membership Level IDs | |
*/ | |
function my_pmpro_iflychat_check_access_filter($access) { | |
$access = true; | |
/** Get current user information **/ | |
global $current_user; | |
wp_get_current_user(); | |
if(is_user_logged_in() && function_exists("pmpro_hasMembershipLevel") && pmpro_hasMembershipLevel(array(1,2)) ) | |
{ | |
$access = true; | |
} | |
else | |
{ | |
$access = false; | |
} | |
return $access; | |
} | |
add_filter('iflychat_check_access_filter', 'my_pmpro_iflychat_check_access_filter'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment