BakerMan

Community Events 1.0.5 (force author)

Apr 12th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. function setup_force_community_author() {
  2.     add_action('save_post', 'force_community_author');
  3. }
  4.  
  5. function force_community_author($postID) {
  6.     // Clear action: this should only run once
  7.     remove_action('save_post', 'force_community_author');
  8.    
  9.     if (!isset($_POST['community-event'])) return;
  10.     if (!check_admin_referer('ecp_event_submission')) return;
  11.    
  12.     wp_update_post(array(
  13.         'ID' => $postID,
  14.         'post_author' => 2 // Change to the ID of the desired author
  15.     ));
  16. }
  17.  
  18. add_action('tribe_ce_before_event_submission_page', 'setup_force_community_author');
Advertisement
Add Comment
Please, Sign In to add comment