Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'transition_post_status', Array( &$this, 'create_post_activity' ), 10, 3 );
- function create_post_activity( $new_status, $old_status, $postid ) {
- $post = &get_post( $postid );
- if ( $new_status != $old_status && $new_status == 'publish' && $post->post_type == $this->id ) {
- $object = get_post_type_object( $post->post_type );
- $args = Array(
- '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 ) ),
- 'content' => '',
- 'type' => 'new_' . $object->id
- );
- $args = apply_filters( 'bpcp_create_' . $object->id . '_activity', $args, $post->ID );
- bp_activity_add( Array(
- 'action' => $args['action'],
- 'component' => $this->id,
- 'content' => $args['content'],
- 'type' => $args['type'],
- 'user_id' => $post->post_author,
- 'item_id' => $post->ID
- ) );
- } else return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment