Advertisement
verygoodplugins

Untitled

Feb 26th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. function my_restrict_access($can_access, $user_id, $post_id) {
  2.    
  3.     if( wp_fusion()->user->has_tag( 'yearly subscriber - one year' ) || wp_fusion()->user->has_tag( 'yearly subscriber - two years' ) ) {
  4.         return true;
  5.     }
  6.  
  7.     $user_access = get_user_meta( $user_id, 'user_access', true );
  8.  
  9.     // user_access is a string like "58,27,54,125"
  10.  
  11.     $user_access = explode(',', $user_access);
  12.  
  13.     if( $post_id == '1074' && in_array('58', $user_access) ) {
  14.  
  15.         // User has access to "58. The Changing Landscape of Australian Documentary",
  16.         return true;
  17.  
  18.     }
  19.  
  20.     return false;
  21.  
  22. }
  23.  
  24. add_filter('wpf_user_can_access', 'my_restrict_access', 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement