Skip to:
Content

BuddyPress.org

Changeset 1750


Ignore:
Timestamp:
09/01/2009 02:12:35 AM (16 years ago)
Author:
apeatling
Message:

Further activity action revisions.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r1749 r1750  
    324324    if ( !BP_Activity_Activity::delete_for_user_by_component( $user_id, $component_name ) )
    325325        return false;
    326        
     326
    327327    do_action( 'bp_activity_delete_for_user_by_component', $user_id, $component_name );
    328328   
  • trunk/bp-blogs.php

    r1749 r1750  
    118118    $bp->blogs->slug = BP_BLOGS_SLUG;
    119119   
    120     /* Register the activity stream actions for this component */
    121     bp_blogs_register_activity_action( 'new_blog', __( 'New blog created', 'buddypress' ) );
    122     bp_blogs_register_activity_action( 'new_blog_post', __( 'New blog post published', 'buddypress' ) );
    123     bp_blogs_register_activity_action( 'new_blog_comment', __( 'New blog post comment posted', 'buddypress' ) );
    124 
    125120    /* Register this in the active components array */
    126121    $bp->active_components[$bp->blogs->slug] = $bp->blogs->id;
     
    225220 */
    226221
     222function bp_blogs_register_activity_actions() {
     223    global $bp;
     224   
     225    if ( !function_exists( 'bp_activity_set_action' ) )
     226        return false;
     227
     228    bp_activity_set_action( $bp->blogs->id, 'new_blog', __( 'New blog created', 'buddypress' ) );
     229    bp_activity_set_action( $bp->blogs->id, 'new_blog_post', __( 'New blog post published', 'buddypress' ) );
     230    bp_activity_set_action( $bp->blogs->id, 'new_blog_comment', __( 'New blog post comment posted', 'buddypress' ) );
     231
     232    do_action( 'bp_blogs_register_activity_actions' );
     233}
     234add_action( 'plugins_loaded', 'bp_blogs_register_activity_actions' );
     235
    227236function bp_blogs_record_activity( $args = '' ) {
    228237    global $bp;
     
    261270}
    262271
    263 function bp_blogs_register_activity_action( $key, $value ) {
    264     global $bp;
    265    
    266     if ( !function_exists( 'bp_activity_set_action' ) )
    267         return false;
    268    
    269     return apply_filters( 'bp_blogs_register_activity_action', bp_activity_set_action( $bp->blogs->id, $key, $value ), $key, $value );
    270 }
    271 
    272272/********************************************************************************
    273273 * Business Functions
     
    329329        'content' => sprintf( __( '%s created the blog %s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_blog_option( $recorded_blog->blog_id, 'siteurl' ) . '">' . attribute_escape( $name ) . '</a>' ),
    330330        'primary_link' => get_blog_option( $recorded_blog->blog_id, 'siteurl' ),
    331         'component_action' => $bp->activity->actions->blogs['new_blog'],
     331        'component_action' => 'new_blog',
    332332        'item_id' => $recorded_blog_id
    333333    ) );
     
    377377                'content' => sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' ),
    378378                'primary_link' => $post_permalink,
    379                 'component_action' => $bp->activity->actions->blogs['new_blog_post'],
     379                'component_action' => 'new_blog_post',
    380380                'item_id' => $recorded_post->id,
    381381                'recorded_time' => $recorded_post->date_created
     
    412412            'content' => sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' ),
    413413            'primary_link' => $post_permalink,
    414             'component_action' => $bp->activity->actions->blogs['new_blog_post'],
     414            'component_action' => 'new_blog_post',
    415415            'item_id' => $existing_post->id,
    416416            'recorded_time' => $existing_post->date_created
     
    458458        'content' => $content,
    459459        'primary_link' => $comment_link,
    460         'component_action' => $bp->activity->actions->blogs['new_blog_comment'],
     460        'component_action' => 'new_blog_comment',
    461461        'item_id' => $recorded_comment->blog_id,
    462462        'recorded_time' =>  $recorded_comment->date_created
     
    482482        'content' => $content,
    483483        'primary_link' => $comment_link,
    484         'component_action' => $bp->activity->actions->blogs['new_blog_comment'],
     484        'component_action' => 'new_blog_comment',
    485485        'item_id' => $recorded_comment->blog_id,
    486486        'recorded_time' =>  $recorded_comment->date_created
  • trunk/bp-friends.php

    r1749 r1750  
    4747    $bp->friends->format_notification_function = 'friends_format_notifications';
    4848    $bp->friends->slug = BP_FRIENDS_SLUG;
    49 
    50     /* Register the activity stream actions for this component */
    51     friends_register_activity_action( 'friendship_created', __( 'New friendship created', 'buddypress' ) );
    52 
     49   
    5350    /* Register this in the active components array */
    5451    $bp->active_components[$bp->friends->slug] = $bp->friends->id;
     
    326323}
    327324
    328 function friends_register_activity_action( $key, $value ) {
     325function friends_register_activity_actions() {
    329326    global $bp;
    330327   
    331328    if ( !function_exists( 'bp_activity_set_action' ) )
    332329        return false;
    333    
    334     return apply_filters( 'friends_register_activity_action', bp_activity_set_action( $bp->friends->id, $key, $value ), $key, $value );
    335 }
     330
     331    bp_activity_set_action( $bp->friends->id, 'friends_register_activity_action', __( 'New friendship created', 'buddypress' ) );
     332
     333    do_action( 'friends_register_activity_actions' );
     334}
     335add_action( 'plugins_loaded', 'friends_register_activity_actions' );
    336336
    337337function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
  • trunk/bp-groups.php

    r1749 r1750  
    148148   
    149149    $bp->groups->valid_status = apply_filters( 'groups_valid_status', array( 'public', 'private', 'hidden' ) );
    150 
    151     /* Register the activity stream actions for this component */
    152     groups_register_activity_action( 'created_group', __( 'Created a group', 'buddypress' ) );
    153     groups_register_activity_action( 'joined_group', __( 'Joined a group', 'buddypress' ) );
    154     groups_register_activity_action( 'new_wire_post', __( 'New group wire post', 'buddypress' ) );
    155     groups_register_activity_action( 'new_forum_topic', __( 'New group forum topic', 'buddypress' ) );
    156     groups_register_activity_action( 'new_forum_post', __( 'New group forum post', 'buddypress' ) );
    157150}
    158151add_action( 'plugins_loaded', 'groups_setup_globals', 5 ); 
     
    13741367 */
    13751368
     1369function groups_register_activity_actions() {
     1370    global $bp;
     1371   
     1372    if ( !function_exists( 'bp_activity_set_action' ) )
     1373        return false;
     1374
     1375    bp_activity_set_action( $bp->groups->id, 'created_group', __( 'Created a group', 'buddypress' ) );
     1376    bp_activity_set_action( $bp->groups->id, 'joined_group', __( 'Joined a group', 'buddypress' ) );
     1377    bp_activity_set_action( $bp->groups->id, 'new_wire_post', __( 'New group wire post', 'buddypress' ) );
     1378    bp_activity_set_action( $bp->groups->id, 'new_forum_topic', __( 'New group forum topic', 'buddypress' ) );
     1379    bp_activity_set_action( $bp->groups->id, 'new_forum_post', __( 'New group forum post', 'buddypress' ) );
     1380
     1381    do_action( 'groups_register_activity_actions' );
     1382}
     1383add_action( 'plugins_loaded', 'groups_register_activity_actions' );
     1384
    13761385function groups_record_activity( $args = '' ) {
    13771386    global $bp;
     
    14001409   
    14011410    return bp_activity_add( array( 'user_id' => $user_id, 'content' => $content, 'primary_link' => $primary_link, 'component_name' => $component_name, 'component_action' => $component_action, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
    1402 }
    1403 
    1404 function groups_register_activity_action( $key, $value ) {
    1405     global $bp;
    1406    
    1407     if ( !function_exists( 'bp_activity_set_action' ) )
    1408         return false;
    1409    
    1410     return apply_filters( 'groups_register_activity_action', bp_activity_set_action( $bp->groups->id, $key, $value ), $key, $value );
    14111411}
    14121412
     
    16771677    /* Delete the activity stream item */
    16781678    if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
    1679         bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['created_group'] ) );
     1679        bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group' ) );
    16801680    }   
    16811681 
     
    19921992        /* Delete the activity stream item */
    19931993        if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
    1994             bp_activity_delete_by_item_id( array( 'item_id' => $wire_post_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['new_wire_post'] ) );
     1994            bp_activity_delete_by_item_id( array( 'item_id' => $wire_post_id, 'component_name' => 'groups', 'component_action' => 'new_wire_post' ) );
    19951995        }
    19961996           
     
    20802080    if ( $topic = bp_forums_update_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id ) ) ) {
    20812081        /* Update the activity stream item */
    2082         bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['new_forum_topic'] ) );
     2082        bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => 'new_forum_topic' ) );
    20832083       
    20842084        $activity_content = sprintf( __( '%s started the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug .'">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     
    21102110        /* Delete the activity stream item */
    21112111        if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
    2112             bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['new_forum_topic'] ) );
     2112            bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => 'new_forum_topic' ) );
    21132113            bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => 'new_forum_post' ) );
    21142114        }
  • trunk/bp-status.php

    r1749 r1750  
    1313    $bp->status->slug = BP_STATUS_SLUG;
    1414   
    15     /* Register the activity stream actions for this component */
    16     bp_status_register_activity_action( 'new_status', __( 'New status update', 'buddypress' ) );
    17 
    1815    /* Register this in the active components array */
    1916    $bp->active_components[$bp->status->slug] = $bp->status->id;
     
    2926 * notifications for the user and for this specific component.
    3027 */
     28
     29function bp_status_register_activity_actions() {
     30    global $bp;
     31   
     32    if ( !function_exists( 'bp_activity_set_action' ) )
     33        return false;
     34
     35    /* Register the activity stream actions for this component */
     36    bp_activity_set_action( $bp->status->id, 'new_status', __( 'New status update', 'buddypress' ) );
     37
     38    do_action( 'bp_status_register_activity_actions' );
     39}
     40add_action( 'plugins_loaded', 'bp_status_register_activity_actions' );
    3141
    3242function bp_status_record_activity( $user_id, $content, $primary_link, $component_action = 'new_status' ) {
  • trunk/bp-xprofile.php

    r1749 r1750  
    140140    $bp->profile->format_notification_function = 'xprofile_format_notifications';
    141141    $bp->profile->slug = BP_XPROFILE_SLUG;
    142 
    143     /* Register the activity stream actions for this component */
    144     xprofile_register_activity_action( 'new_wire_post', __( 'New profile wire post', 'buddypress' ) );
    145142
    146143    /* Register this in the active components array */
     
    580577 */
    581578
     579function xprofile_register_activity_actions() {
     580    global $bp;
     581   
     582    if ( !function_exists( 'bp_activity_set_action' ) )
     583        return false;
     584
     585    /* Register the activity stream actions for this component */
     586    bp_activity_set_action( $bp->profile->id, 'new_wire_post', __( 'New profile wire post', 'buddypress' ) );
     587
     588    do_action( 'xprofile_register_activity_actions' );
     589}
     590add_action( 'plugins_loaded', 'xprofile_register_activity_actions' );
     591
    582592/**
    583593 * xprofile_record_activity()
Note: See TracChangeset for help on using the changeset viewer.