Guest User

Untitled

a guest
Jul 24th, 2010
192
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2.     add_action( 'transition_post_status', Array( &$this, 'create_post_activity' ), 10, 3 );
  3.  
  4.     function create_post_activity( $new_status, $old_status, $postid ) {
  5.         $post = &get_post( $postid );
  6.  
  7.         if ( $new_status != $old_status && $new_status == 'publish' && $post->post_type == $this->id  ) {
  8.  
  9.             $object = get_post_type_object( $post->post_type );
  10.  
  11.             $args = Array(
  12.                 'action' => sprintf( __( "%s created the %s <a href = '%s'>%s</a>." ), bp_core_get_userlink( $post->post_author ), $object->labels->singular_name, get_permalink( $post->ID ), get_the_title( $post_id ) ),
  13.                 'content' => '',
  14.                 'type' => 'new_' . $object->id
  15.             );
  16.  
  17.             $args = apply_filters( 'bpcp_create_' . $object->id . '_activity', $args, $post->ID );
  18.  
  19.             bp_activity_add( Array(
  20.                 'action' => $args['action'],
  21.                 'component' => $this->id,
  22.                 'content' => $args['content'],
  23.                 'type' => $args['type'],
  24.                 'user_id' => $post->post_author,
  25.                 'item_id' => $post->ID
  26.             ) );
  27.  
  28.         } else return false;
  29.     }
RAW Paste Data