Created
March 10, 2016 16:51
-
-
Save strangerstudios/19ad6ce612752e52d035 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; | |
get_currentuserinfo(); | |
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
This recipe is included in the blog post on "Members-Only Live Chat and Chatrooms using Arrowchat, iFlyChat, Wise Chat, Zopim" at Paid Memberships Pro here: https://www.paidmembershipspro.com/members-live-chat-chatrooms-using-arrowchat-iflychat-wise-chat-zopim/