SHARE
TWEET

Untitled

a guest Jun 26th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(strtomtime('now')>get_the_author_meta('expire_by', $user_id)){
  2. // let the user post
  3. } else {
  4. // prevent from posting
  5. // show an error
  6. }
  7.      
  8. add_action( 'transition_post_status', 'check_plan_validity', 11, 3 );
  9.  function check_plan_validity( $new_status, $old_status, $post ) {
  10.      $expire_by = (int) get_the_author_meta('expire_by', $post->post_author);
  11.      $now = strtotime("now");
  12.      if($now>$expire_by){
  13.          $error['error'] = 'Plan expired';
  14.          echo json_encode($error);
  15.          die();
  16.      }
  17.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top