Advertisement
verygoodplugins

Untitled

Nov 12th, 2020
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. function disallow_before_date_published( $can_access, $user_id, $post_id ) {
  2.  
  3.     $published = get_the_date( 'U', $post_id );
  4.     $userdata  = get_userdata( $user_id );
  5.  
  6.     if ( strtotime( $userdata->user_registered ) < $published ) {
  7.         $can_access = false;
  8.     }
  9.  
  10.     return $can_access;
  11.  
  12. }
  13.  
  14. add_filter( 'wpf_user_can_access', 'disallow_before_date_published', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement