Plugin Directory

Changeset 405628


Ignore:
Timestamp:
07/06/2011 06:50:15 PM (15 years ago)
Author:
kunalb
Message:

Corrected the activity stream errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • buddypress-custom-posts/trunk/controller.php

    r368058 r405628  
    825825
    826826            $args = Array(
    827                 '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 ) ),
     827                '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 ), $post->post_title ),
    828828                'content' => '',
    829829                'type' => 'new_' . $object->id
     
    831831
    832832            $args = apply_filters( 'bpcp_create_' . $object->id . '_activity', apply_filters( 'bpcp_create_activity', $args, $post->ID ), $post->ID ); 
     833            do_action( 'bpcp_create_activity', $args );
    833834
    834835            bp_activity_add( Array(
     
    840841                'item_id' => $post->ID
    841842            ) );
    842 
    843843        } else return false;
    844844    }
     
    882882     */
    883883    function edit_post_activity( $postid, $post ) {
    884         //Eliminating Create
    885         if ( !( $new_status != $old_status && $new_status == 'publish' && $post->post_type == $this->id  ) ) {
    886             if ( $post->post_status == 'publish' && $post->post_type == $this->id ) {
    887                 $object = get_post_type_object( $post->post_type );
    888 
    889                 $args = Array(
    890                     'action' => sprintf( __( "%s updated 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 ) ),
    891                     'content' => '',
    892                     'type' => 'activity_update'
    893                 );
    894 
    895                 $args = apply_filters( 'bpcp_edit_' . $object->id . '_activity', apply_filters( 'bpcp_edit_activity', $args, $post->ID ) );
    896 
    897                 bp_activity_add( Array(
    898                     'action' => $args['action'],
    899                     'component' => $this->id,
    900                     'content' => $args['content'],
    901                     'type' => $args['type'],
    902                     'user_id' => $post->post_author,
    903                     'item_id' => $post->ID
    904                 ) );
    905             }
    906         }
     884        if ( $post->post_status == 'publish' && $post->post_type == $this->id && did_action( 'bpcp_create_activity' ) <= 0 ) {
     885            $object = get_post_type_object( $post->post_type );
     886
     887            $args = Array(
     888                'action' => sprintf( __( "%s updated 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 ) ),
     889                'content' => '',
     890                'type' => 'activity_update'
     891            );
     892
     893            $args = apply_filters( 'bpcp_edit_' . $object->id . '_activity', apply_filters( 'bpcp_edit_activity', $args, $post->ID ) );
     894
     895            bp_activity_add( Array(
     896                'action' => $args['action'],
     897                'component' => $this->id,
     898                'content' => $args['content'],
     899                'type' => $args['type'],
     900                'user_id' => $post->post_author,
     901                'item_id' => $post->ID
     902            ) );
     903        } else return false;
    907904    }
    908905
Note: See TracChangeset for help on using the changeset viewer.