Guest User

Untitled

a guest
Oct 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. add_filter( 'wp_insert_post_empty_content', 'test_user_can_do_this', PHP_INT_MAX -1, 2);
  2.  
  3. function test_user_can_do_this($maybe_empty, $postarr) {
  4. // not a special role, ignore
  5. if (!is_client_user()) return $maybe_empty;
  6. $post_owner = $postarr['post_author'];
  7.  
  8. // custom tests compare post owner vs current user
  9. if (is_grouped_with($post_owner)) return $maybe_empty;
  10. if (is_grouped_under($post_owner)) return $maybe_empty;
  11.  
  12. // otherwise, deny save
  13. return true;
  14. }
Add Comment
Please, Sign In to add comment