Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement