Skip to:
Content

BuddyPress.org

Changeset 2381


Ignore:
Timestamp:
01/20/2010 04:21:20 PM (15 years ago)
Author:
apeatling
Message:

Standardizing activity stream fields and splitting the action from the content for better manageability.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r2362 r2381  
    11<?php
    22
    3 define ( 'BP_ACTIVITY_DB_VERSION', '2020' );
     3define ( 'BP_ACTIVITY_DB_VERSION', '2031' );
    44
    55/* Define the slug for the component */
     
    1818
    1919    /* Rename the old user activity cached table if needed. */
    20     $wpdb->query( "RENAME TABLE {$wpdb->base_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
    21 
     20    if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$wpdb->base_prefix}bp_activity_user_activity_cached%'" ) ) {
     21        $wpdb->query( "RENAME TABLE {$wpdb->base_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
     22    }
     23
     24    /* Rename fields from pre BP 1.2 */
     25    if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->activity->table_name}%'" ) ) {
     26        $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE type type varchar(75) NOT NULL" );
     27        $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component component varchar(75) NOT NULL" );
     28    }
     29
     30    /**
     31     * Build the tables
     32     */
    2233    $sql[] = "CREATE TABLE {$bp->activity->table_name} (
    2334                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    2435                user_id bigint(20) NOT NULL,
    25                 component_name varchar(75) NOT NULL,
    26                 component_action varchar(75) NOT NULL,
     36                component varchar(75) NOT NULL,
     37                type varchar(75) NOT NULL,
     38                action text NOT NULL
    2739                content longtext NOT NULL,
    2840                primary_link varchar(150) NOT NULL,
    2941                item_id varchar(75) NOT NULL,
    30                 secondary_item_id varchar(75) NOT NULL,
     42                secondary_item_id varchar(75) DEFAULT NULL,
    3143                date_recorded datetime NOT NULL,
    3244                hide_sitewide bool DEFAULT 0,
     
    3648                KEY user_id (user_id),
    3749                KEY item_id (item_id),
    38                 KEY component_name (component_name)
     50                KEY component (component)
    3951               ) {$charset_collate};";
    4052
     
    167179    $has_access = true;
    168180    /* Redirect based on the type of activity */
    169     if ( $activity->component_name == $bp->groups->id ) {
     181    if ( $activity->component == $bp->groups->id ) {
    170182        if ( !function_exists( 'groups_get_group' ) )
    171183            bp_core_redirect( $bp->root_domain );
     
    248260    $redirect = false;
    249261    /* Redirect based on the type of activity */
    250     if ( $activity->component_name == $bp->groups->id ) {
     262    if ( $activity->component == $bp->groups->id ) {
    251263        if ( $activity->user_id )
    252264            $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id;
     
    445457        'id' => false, // Pass an existing activity ID to update an existing entry.
    446458
    447         'content' => false, // The content of the activity item
    448         'primary_link' => false, // The primary URL for this item in RSS feeds
    449         'component_name' => false, // The name/ID of the component e.g. groups, profile, mycomponent
    450         'component_action' => false, // The component action e.g. activity_update, profile_updated
     459        'action' => '', // The activity action - e.g. "Jon Doe posted an update"
     460        'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
     461
     462        'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent
     463        'type' => false, // The activity type e.g. activity_update, profile_updated
     464        'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
    451465
    452466        'user_id' => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
     
    460474    extract( $params, EXTR_SKIP );
    461475
    462     /* Insert the "time-since" placeholder */
    463     if ( $content )
     476    /* Make sure we are backwards compatible */
     477    if ( empty( $component ) && !empty( $component_name ) )
     478        $component = $component_name;
     479
     480    if ( empty( $type ) && !empty( $component_action ) )
     481        $type = $component_action;
     482
     483    /* Insert the "time-since" placeholder (use content if action empty for backwards compat) */
     484    if ( !empty( $action ) )
     485        $action = bp_activity_add_timesince_placeholder( $action );
     486    else if ( empty( $action ) && !empty( $content ) )
    464487        $content = bp_activity_add_timesince_placeholder( $content );
    465488
     489    /* Remove any images and replace the first image with a thumbnail */
     490    //$content = bp_activity_thumbnail_images( $content );
     491
    466492    $activity = new BP_Activity_Activity( $id );
    467493
    468494    $activity->user_id = $user_id;
     495    $activity->component = $component;
     496    $activity->type = $type;
     497    $activity->action = $action;
    469498    $activity->content = $content;
    470499    $activity->primary_link = $primary_link;
    471     $activity->component_name = $component_name;
    472     $activity->component_action = $component_action;
    473500    $activity->item_id = $item_id;
    474501    $activity->secondary_item_id = $secondary_item_id;
     
    480507
    481508    /* If this is an activity comment, rebuild the tree */
    482     if ( 'activity_comment' == $activity->component_action )
     509    if ( 'activity_comment' == $activity->type )
    483510        BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id );
    484511
     
    499526    extract( $r, EXTR_SKIP );
    500527
    501     if ( empty($content) || empty($content) )
     528    if ( empty( $content ) )
    502529        return false;
    503530
    504531    /* Record this on the user's profile */
    505532    $from_user_link = bp_core_get_userlink( $user_id );
    506     $activity_content = sprintf( __('%s posted an update:', 'buddypress'), $from_user_link );
    507     $activity_content .= '<div class="activity-inner">' . $content . '</div>';
     533    $activity_action = sprintf( __( '%s posted an update:', 'buddypress' ), $from_user_link );
     534    $activity_content = '<div class="activity-inner">' . $content . '</div>';
    508535
    509536    $primary_link = bp_core_get_userlink( $user_id, false, true );
     
    512539    $activity_id = bp_activity_add( array(
    513540        'user_id' => $user_id,
     541        'action' => apply_filters( 'bp_activity_new_update_action', $activity_action ),
    514542        'content' => apply_filters( 'bp_activity_new_update_content', $activity_content ),
    515543        'primary_link' => apply_filters( 'bp_activity_new_update_primary_link', $primary_link ),
    516         'component_name' => $bp->activity->id,
    517         'component_action' => 'activity_update'
     544        'component' => $bp->activity->id,
     545        'type' => 'activity_update'
    518546    ) );
    519547
     
    552580        'content' => apply_filters( 'bp_activity_comment_content', $comment_header . '<div class="activity-inner">' . $content . '</div>' ),
    553581        'primary_link' => '',
    554         'component_name' => $bp->activity->id,
    555         'component_action' => 'activity_comment',
     582        'component' => $bp->activity->id,
     583        'type' => 'activity_comment',
    556584        'user_id' => $user_id,
    557585        'item_id' => $activity_id,
     
    588616    $defaults = array(
    589617        'item_id' => false,
    590         'component_name' => false,
    591         'component_action' => false, // optional
     618        'component' => false,
     619        'type' => false, // optional
    592620        'user_id' => false, // optional
    593621        'secondary_item_id' => false // optional
     
    597625    extract( $r, EXTR_SKIP );
    598626
    599     if ( !$activity_ids_deleted = BP_Activity_Activity::delete_by_item_id( $item_id, $component_name, $component_action, $user_id, $secondary_item_id ) )
    600         return false;
    601 
    602     do_action( 'bp_activity_delete_by_item_id', $item_id, $component_name, $component_action, $user_id, $secondary_item_id );
     627    if ( !$activity_ids_deleted = BP_Activity_Activity::delete_by_item_id( $item_id, $component, $type, $user_id, $secondary_item_id ) )
     628        return false;
     629
     630    do_action( 'bp_activity_delete_by_item_id', $item_id, $component, $type, $user_id, $secondary_item_id );
    603631    do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
    604632
     
    616644}
    617645
    618 function bp_activity_delete_by_content( $user_id, $content, $component_name, $component_action ) {
     646function bp_activity_delete_by_content( $user_id, $content, $component, $type ) {
    619647    /* Insert the "time-since" placeholder to match the existing content in the DB */
    620648    $content = bp_activity_add_timesince_placeholder( $content );
    621649
    622     if ( !$activity_ids_deleted = BP_Activity_Activity::delete_by_content( $user_id, $content, $component_name, $component_action ) )
    623         return false;
    624 
    625     do_action( 'bp_activity_delete_by_content', $user_id, $content, $component_name, $component_action );
     650    if ( !$activity_ids_deleted = BP_Activity_Activity::delete_by_content( $user_id, $content, $component, $type ) )
     651        return false;
     652
     653    do_action( 'bp_activity_delete_by_content', $user_id, $content, $component, $type );
    626654    do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
    627655
     
    629657}
    630658
    631 function bp_activity_delete_for_user_by_component( $user_id, $component_name ) {
    632     if ( !$activity_ids_deleted = BP_Activity_Activity::delete_for_user_by_component( $user_id, $component_name ) )
    633         return false;
    634 
    635     do_action( 'bp_activity_delete_for_user_by_component', $user_id, $component_name );
     659function bp_activity_delete_for_user_by_component( $user_id, $component ) {
     660    if ( !$activity_ids_deleted = BP_Activity_Activity::delete_for_user_by_component( $user_id, $component ) )
     661        return false;
     662
     663    do_action( 'bp_activity_delete_for_user_by_component', $user_id, $component );
    636664    do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
    637665
     
    645673        $activity_obj = new BP_Activity_Activity( $activity_id );
    646674
    647     if ( 'new_blog_post' == $activity_obj->component_action || 'new_blog_comment' == $activity_obj->component_action || 'new_forum_topic' == $activity_obj->component_action || 'new_forum_post' == $activity_obj->component_action )
     675    if ( 'new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type )
    648676        $link = $activity_obj->primary_link;
    649677    else {
    650         if ( 'activity_comment' == $activity_obj->component_action )
     678        if ( 'activity_comment' == $activity_obj->type )
    651679            $link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj->item_id . '/';
    652680        else
     
    682710}
    683711
     712function bp_activity_thumbnail_images( $content ) {
     713    preg_match_all( '/<img[^>]*>/Ui', $content, $matches );
     714    $content = preg_replace('/<img[^>]*>/Ui', '', $content );
     715
     716    if ( !empty( $matches ) ) {
     717        /* Get the SRC value */
     718        preg_match( '/<img.*?(src\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $src );
     719
     720        if ( !empty( $src ) ) {
     721            $src = substr( substr( str_replace( 'src=', '', $src[1] ), 0, -1 ), 1 );
     722            $pos = strpos( $content, '<blockquote>' );
     723            $before = substr( $content, 0, (int) $pos );
     724            $after = substr( $content, (int) $pos, strlen( $content ) );
     725
     726            $content = $before . '<img src="' . esc_attr( $src) . '" width="100" height="100" alt="thumb" class="align-left thumbnail" />' . $after;
     727        }
     728    }
     729
     730    return $content;
     731}
     732
    684733function bp_activity_set_action( $component_id, $key, $value ) {
    685734    global $bp;
  • trunk/bp-activity/bp-activity-classes.php

    r2369 r2381  
    77    var $user_id;
    88    var $primary_link;
    9     var $component_name;
    10     var $component_action;
     9    var $component;
     10    var $type;
     11    var $action;
     12    var $content;
    1113    var $date_recorded;
    1214    var $hide_sitewide = false;
     
    2426        global $wpdb, $bp;
    2527
    26         $activity = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
     28        $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
    2729
    2830        if ( $activity ) {
    29             $this->id = $activity->id;
    30             $this->item_id = $activity->item_id;
    31             $this->secondary_item_id = $activity->secondary_item_id;
    32             $this->user_id = $activity->user_id;
    33             $this->content = $activity->content;
    34             $this->primary_link = $activity->primary_link;
    35             $this->component_name = $activity->component_name;
    36             $this->component_action = $activity->component_action;
    37             $this->date_recorded = $activity->date_recorded;
    38             $this->hide_sitewide = $activity->hide_sitewide;
     31            $this->id = $row->id;
     32            $this->item_id = $row->item_id;
     33            $this->secondary_item_id = $row->secondary_item_id;
     34            $this->user_id = $row->user_id;
     35            $this->primary_link = $row->primary_link;
     36            $this->component = $row->component;
     37            $this->type = $row->type;
     38            $this->action = $row->type;
     39            $this->content = $row->content;
     40            $this->date_recorded = $row->date_recorded;
     41            $this->hide_sitewide = $row->hide_sitewide;
    3942        }
    4043    }
     
    4548        do_action( 'bp_activity_before_save', $this );
    4649
    47         if ( !$this->component_name || !$this->component_action )
     50        if ( !$this->component || !$this->type )
    4851            return false;
    4952
     
    5356        /* If we have an existing ID, update the activity item, otherwise insert it. */
    5457        if ( $this->id )
    55             $q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component_name = %s, component_action = %s, content = %s, primary_link = %s, date_recorded = FROM_UNIXTIME(%d), item_id = %s, secondary_item_id = %s, hide_sitewide = %d WHERE id = %d", $this->user_id, $this->component_name, $this->component_action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->id );
     58            $q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = FROM_UNIXTIME(%d), item_id = %s, secondary_item_id = %s, hide_sitewide = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->id );
    5659        else
    57             $q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component_name, component_action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide ) VALUES ( %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), %s, %s, %d )", $this->user_id, $this->component_name, $this->component_action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide );
     60            $q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide ) VALUES ( %d, %s, %s, %s, %s, %s, FROM_UNIXTIME(%d), %s, %s, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide );
    5861
    5962        if ( !$wpdb->query( $q ) )
     
    6871    /* Static Functions */
    6972
    70     function delete( $item_id, $component_name, $component_action, $user_id = false, $secondary_item_id = false ) {
     73    function delete( $item_id, $component, $type, $user_id = false, $secondary_item_id = false ) {
    7174        global $wpdb, $bp;
    7275
     
    7477            $secondary_sql = $wpdb->prepare( "AND secondary_item_id = %s", $secondary_item_id );
    7578
    76         if ( $component_action )
    77             $component_action_sql = $wpdb->prepare( "AND component_action = %s", $component_action );
     79        if ( $type )
     80            $type_sql = $wpdb->prepare( "AND type = %s", $type );
    7881
    7982        if ( $user_id )
     
    8184
    8285        /* Fetch the activity IDs so we can delete any comments for this activity item */
    83         $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}", $item_id, $component_name ) );
    84 
    85         error_log( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}", $item_id, $component_name ) );
    86 
    87         if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}", $item_id, $component_name ) ) )
     86        $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component = %s {$type_sql} {$user_sql}", $item_id, $component ) );
     87
     88        error_log( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component = %s {$type_sql} {$user_sql}", $item_id, $component ) );
     89
     90        if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component = %s {$type_sql} {$user_sql}", $item_id, $component ) ) )
    8891            return false;
    8992
     
    98101    }
    99102
    100     function delete_by_item_id( $item_id, $component_name, $component_action, $user_id = false, $secondary_item_id = false ) {
    101         return BP_Activity_Activity::delete( $item_id, $component_name, $component_action, $user_id, $secondary_item_id );
     103    function delete_by_item_id( $item_id, $component, $type, $user_id = false, $secondary_item_id = false ) {
     104        return BP_Activity_Activity::delete( $item_id, $component, $type, $user_id, $secondary_item_id );
    102105    }
    103106
     
    115118    }
    116119
    117     function delete_by_content( $user_id, $content, $component_name, $component_action ) {
     120    function delete_by_content( $user_id, $content, $component, $type ) {
    118121        global $bp, $wpdb;
    119122
    120123        /* Fetch the activity ID so we can delete any comments for this activity item */
    121         $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component_name = %s AND component_action = %s", $user_id, $content, $component_name, $component_action ) );
    122 
    123         if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component_name = %s AND component_action = %s", $user_id, $content, $component_name, $component_action ) ) )
     124        $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component = %s AND type = %s", $user_id, $content, $component, $type ) );
     125
     126        if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component = %s AND type = %s", $user_id, $content, $component, $type ) ) )
    124127            return false;
    125128
     
    134137    }
    135138
    136     function delete_for_user_by_component( $user_id, $component_name ) {
     139    function delete_for_user_by_component( $user_id, $component ) {
    137140        global $bp, $wpdb;
    138141
    139142        /* Fetch the activity IDs so we can delete any comments for this activity item */
    140         $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND component_name = %s", $user_id, $component_name ) );
    141 
    142         if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND component_name = %s", $user_id, $component_name ) ) )
     143        $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND component = %s", $user_id, $component ) );
     144
     145        if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND component = %s", $user_id, $component ) ) )
    143146            return false;
    144147
     
    178181        $activity_ids = $wpdb->escape( $activity_ids );
    179182
    180         return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE component_action = 'activity_comment' AND item_id IN ({$activity_ids})" ) );
     183        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ) );
    181184    }
    182185
     
    238241        /* Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity */
    239242        if ( !$display_comments || 'threaded' == $display_comments ) {
    240             $where_conditions[] = "a.component_action != 'activity_comment'";
     243            $where_conditions[] = "a.type != 'activity_comment'";
    241244        }
    242245
     
    268271        $activity_ids = $wpdb->escape( $activity_ids );
    269272
     273        if ( empty( $activity_ids ) )
     274            return false;
     275
    270276        if ( $per_page && $page )
    271277            $pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
     
    294300        /* Now fetch the activity comments and parse them into the correct position in the activities array. */
    295301        foreach( $activities as $activity ) {
    296             if ( 'activity_comment' != $activity->component_action && $activity->mptt_left && $activity->mptt_right )
     302            if ( 'activity_comment' != $activity->type && $activity->mptt_left && $activity->mptt_right )
    297303                $activity_comments[$activity->id] = BP_Activity_Activity::get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right );
    298304        }
     
    320326        }
    321327
    322         $descendants = $wpdb->get_results( $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.component_action = 'activity_comment' AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC", $activity_id, $left, $right ) );
     328        $descendants = $wpdb->get_results( $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC", $activity_id, $left, $right ) );
    323329
    324330        /* Loop descendants and build an assoc array */
     
    348354
    349355        /* Get all descendants of this node */
    350         $descendants = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE component_action = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
     356        $descendants = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
    351357
    352358        /* Loop the descendants and recalculate the left and right values */
     
    358364            $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE id = %d", $left, $right, $parent_id ) );
    359365        else
    360             $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE component_action = 'activity_comment' AND id = %d", $left, $right, $parent_id ) );
     366            $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE type = 'activity_comment' AND id = %d", $left, $right, $parent_id ) );
    361367
    362368        /* Return the right value of this node + 1 */
     
    364370    }
    365371
    366     function get_recorded_component_names() {
    367         global $wpdb, $bp;
    368 
    369         return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component_name FROM {$bp->activity->table_name} ORDER BY component_name ASC" ) );
     372    function get_recorded_components() {
     373        global $wpdb, $bp;
     374
     375        return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ) );
    370376    }
    371377
     
    414420            $counter = 1;
    415421            foreach( (array) $object_filter as $object ) {
    416                 $object_sql .= $wpdb->prepare( "a.component_name = %s", trim( $object ) );
     422                $object_sql .= $wpdb->prepare( "a.component = %s", trim( $object ) );
    417423
    418424                if ( $counter != count( $object_filter ) )
     
    432438            $counter = 1;
    433439            foreach( (array) $action_filter as $action ) {
    434                 $action_sql .= $wpdb->prepare( "a.component_action = %s", trim( $action ) );
     440                $action_sql .= $wpdb->prepare( "a.type = %s", trim( $action ) );
    435441
    436442                if ( $counter != count( $action_filter ) )
  • trunk/bp-activity/bp-activity-templatetags.php

    r2375 r2381  
    266266    function bp_get_activity_object_name() {
    267267        global $activities_template;
    268         return apply_filters( 'bp_get_activity_object_name', $activities_template->activity->component_name );
    269     }
    270 
    271 function bp_activity_action_name() {
    272     echo bp_get_activity_action_name();
    273 }
    274     function bp_get_activity_action_name() {
    275         global $activities_template;
    276         return apply_filters( 'bp_get_activity_action_name', $activities_template->activity->component_action );
    277     }
     268        return apply_filters( 'bp_get_activity_object_name', $activities_template->activity->component );
     269    }
     270
     271function bp_activity_type() {
     272    echo bp_get_activity_type();
     273}
     274    function bp_get_activity_type() {
     275        global $activities_template;
     276        return apply_filters( 'bp_get_activity_type', $activities_template->activity->type );
     277    }
     278    function bp_activity_action_name() { echo bp_activity_type(); }
     279    function bp_get_activity_action_name() { return bp_get_activity_type(); }
    278280
    279281function bp_activity_user_id() {
     
    310312
    311313        $object = 'user';
    312         if ( $bp->groups->id == $activities_template->activity->component_name && !(int) $activities_template->activity->user_id )
     314        if ( $bp->groups->id == $activities_template->activity->component && !(int) $activities_template->activity->user_id )
    313315            $object = 'group';
    314         if ( $bp->blogs->id == $activities_template->activity->component_name && !(int) $activities_template->activity->user_id )
     316        if ( $bp->blogs->id == $activities_template->activity->component && !(int) $activities_template->activity->user_id )
    315317            $object = 'blog';
    316318
    317         $object = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component_name, $object );
     319        $object = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component, $object );
    318320
    319321        /* If this is a user object pass the users' email address for Gravatar so we don't have to refetch it. */
     
    324326    }
    325327
     328function bp_activity_action() {
     329    echo bp_get_activity_action();
     330}
     331    function bp_get_activity_action() {
     332        global $activities_template;
     333
     334        return apply_filters( 'bp_get_activity_action', bp_activity_content_filter( $activities_template->activity->action, $activities_template->activity->date_recorded ), $activities_template->activity->component, $activities_template->activity->type );
     335    }
     336
     337function bp_activity_content_body() {
     338    echo bp_get_activity_content_body();
     339}
     340    function bp_get_activity_content_body() {
     341        global $activities_template;
     342
     343        if ( empty( $activities_template->activity->action ) )
     344            $activities_template->activity->content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded );
     345
     346        return apply_filters( 'bp_get_activity_content_body', $activities_template->activity->content );
     347    }
     348
    326349function bp_activity_content() {
    327350    echo bp_get_activity_content();
    328351}
    329352    function bp_get_activity_content() {
    330         global $activities_template, $allowed_tags, $bp;
    331 
    332         if ( bp_is_home() && $activities_template->activity_type == 'personal' )
    333             $content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name );
    334         else
    335             $content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name, true, false, false );
    336 
    337         return apply_filters( 'bp_get_activity_content', $content, $activities_template->activity->component_name, $activities_template->activity->component_action );
    338     }
    339 
    340 function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $filter_words = true, $filter_you = true ) {
     353        global $activities_template;
     354
     355        if ( empty( $activities_template->activity->action ) )
     356            $content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded );
     357        else {
     358            $content = bp_activity_content_filter( $activities_template->activity->action, $activities_template->activity->date_recorded );
     359            $content .= $activities_template->activity->content;
     360        }
     361
     362        return apply_filters( 'bp_get_activity_content', $content, $activities_template->activity->component, $activities_template->activity->type );
     363    }
     364
     365function bp_activity_content_filter( $content, $date_recorded ) {
    341366    global $activities_template, $bp;
    342367
     
    351376
    352377    /* Insert the time since */
    353     if ( $insert_time )
    354         $content[0] = bp_activity_insert_time_since( $content[0], $date_recorded );
    355 
    356     // The "You" and "Your" conversion is only done in english, if a translation file is present
    357     // then do not translate as it causes problems in other languages.
    358     if ( '' == get_locale() ) {
    359         /* Switch 'their/your' depending on whether the user is logged in or not and viewing their profile */
    360         if ( $filter_words ) {
    361             $content[0] = preg_replace( '/their\s/', 'your ', $content[0] );
    362         }
    363 
    364         /* Remove the 'You' and replace if with the persons name */
    365         if ( $filter_you && $full_name != '' ) {
    366             $content[0] = preg_replace( "/{$full_name}[<]/", 'You<', $content[0], 1 );
    367         }
    368     }
     378    $content[0] = bp_activity_insert_time_since( $content[0], $date_recorded );
    369379
    370380    /* Add the permalink */
     
    559569
    560570        $class = '';
    561         if ( in_array( $activities_template->activity->component_action, (array)$mini_activity_actions ) )
     571        if ( in_array( $activities_template->activity->type, (array)$mini_activity_actions ) )
    562572            $class = ' mini';
    563573
     
    565575            $class .= ' has-comments';
    566576
    567         return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component_name . ' ' . $activities_template->activity->component_action . $class );
     577        return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class );
    568578    }
    569579
     
    609619
    610620        /* Fetch the names of components that have activity recorded in the DB */
    611         $component_names = BP_Activity_Activity::get_recorded_component_names();
    612 
    613         if ( !$component_names )
     621        $components = BP_Activity_Activity::get_recorded_components();
     622
     623        if ( !$components )
    614624            return false;
    615625
    616         foreach ( (array) $component_names as $component_name ) {
     626        foreach ( (array) $components as $component ) {
    617627            /* Skip the activity comment filter */
    618             if ( 'activity' == $component_name )
     628            if ( 'activity' == $component )
    619629                continue;
    620630
    621             if ( isset( $_GET['afilter'] ) && $component_name == $_GET['afilter'] )
     631            if ( isset( $_GET['afilter'] ) && $component == $_GET['afilter'] )
    622632                $selected = ' class="selected"';
    623633            else
    624634                unset($selected);
    625635
    626             $component_name = attribute_escape( $component_name );
     636            $component = attribute_escape( $component );
    627637
    628638            switch ( $style ) {
    629639                case 'list':
    630640                    $tag = 'li';
    631                     $before = '<li id="afilter-' . $component_name . '"' . $selected . '>';
     641                    $before = '<li id="afilter-' . $component . '"' . $selected . '>';
    632642                    $after = '</li>';
    633643                break;
    634644                case 'paragraph':
    635645                    $tag = 'p';
    636                     $before = '<p id="afilter-' . $component_name . '"' . $selected . '>';
     646                    $before = '<p id="afilter-' . $component . '"' . $selected . '>';
    637647                    $after = '</p>';
    638648                break;
    639649                case 'span':
    640650                    $tag = 'span';
    641                     $before = '<span id="afilter-' . $component_name . '"' . $selected . '>';
     651                    $before = '<span id="afilter-' . $component . '"' . $selected . '>';
    642652                    $after = '</span>';
    643653                break;
    644654            }
    645655
    646             $link = add_query_arg( 'afilter', $component_name );
     656            $link = add_query_arg( 'afilter', $component );
    647657            $link = remove_query_arg( 'acpage' , $link );
    648658
    649             $link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component_name );
     659            $link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component );
    650660
    651661            /* Make sure all core internal component names are translatable */
    652             $translatable_component_names = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
    653 
    654             $component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component_name, 'buddypress' ) ) . '</a>' . $after;
     662            $translatable_components = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
     663
     664            $component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component, 'buddypress' ) ) . '</a>' . $after;
    655665        }
    656666
     
    745755        global $activities_template;
    746756
    747         $content = explode( '<span', $activities_template->activity->content );
     757        if ( !empty( $activities_template->activity->action ) )
     758            $content = $activities_template->activity->action;
     759        else
     760            $content = $activities_template->activity->content;
     761
     762        $content = explode( '<span', $content );
    748763        $title = trim( strip_tags( html_entity_decode( $content[0] ) ) );
    749764
     
    751766            $title = substr( $title, 0, -1 );
    752767
    753         if ( 'activity_update' == $activities_template->activity->component_action ) {
     768        if ( 'activity_update' == $activities_template->activity->type ) {
    754769            $content = explode( '<div class="activity-inner">', $activities_template->activity->content );
    755770            $title .= ': ' . strip_tags( bp_create_excerpt( $content[1], 15 ));
     
    783798        global $activities_template;
    784799
    785         return apply_filters( 'bp_get_activity_feed_item_description', html_entity_decode( str_replace( '%s', '', $activities_template->activity->content ), ENT_COMPAT, 'UTF-8' ) );
     800        if ( empty( $activities_template->activity->action ) )
     801            $content = $activities_template->activity->content;
     802        else
     803            $content = $activities_template->activity->action . $activities_template->activity->content;
     804
     805        return apply_filters( 'bp_get_activity_feed_item_description', html_entity_decode( str_replace( '%s', '', $content ), ENT_COMPAT, 'UTF-8' ) );
    786806    }
    787807
  • trunk/bp-blogs.php

    r2328 r2381  
    246246    $defaults = array(
    247247        'user_id' => $bp->loggedin_user->id,
    248         'content' => false,
    249         'primary_link' => false,
    250         'component_name' => $bp->blogs->id,
    251         'component_action' => false,
     248        'action' => '',
     249        'content' => '',
     250        'primary_link' => '',
     251        'component' => $bp->blogs->id,
     252        'type' => false,
    252253        'item_id' => false,
    253254        'secondary_item_id' => false,
     
    259260    extract( $r, EXTR_SKIP );
    260261
    261     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 ) );
     262    return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
    262263}
    263264
     
    268269        $defaults = array(
    269270            'item_id' => false,
    270             'component_name' => $bp->blogs->id,
    271             'component_action' => false,
     271            'component' => $bp->blogs->id,
     272            'type' => false,
    272273            'user_id' => false,
    273274            'secondary_item_id' => false
     
    279280        bp_activity_delete_by_item_id( array(
    280281            'item_id' => $item_id,
    281             'component_name' => $component_name,
    282             'component_action' => $component_action,
     282            'component' => $component,
     283            'type' => $type,
    283284            'user_id' => $user_id,
    284285            'secondary_item_id' => $secondary_item_id
     
    341342        bp_blogs_record_activity( array(
    342343            'user_id' => $recorded_blog->user_id,
    343             'content' => apply_filters( 'bp_blogs_activity_created_blog', 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>' ), &$recorded_blog, $name, $description ),
     344            'action' => apply_filters( 'bp_blogs_activity_created_blog_action', 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>' ), &$recorded_blog, $name, $description ),
    344345            'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_blog_option( $recorded_blog->blog_id, 'siteurl' ), $recorded_blog->blog_id ),
    345             'component_action' => 'new_blog',
     346            'type' => 'new_blog',
    346347            'item_id' => $recorded_blog->blog_id
    347348        ) );
     
    389390                $post_permalink = bp_post_get_permalink( $post, $blog_id );
    390391
    391                 $activity_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>' );
    392                 $activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
     392                $activity_action = 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>' );
     393                $activity_content = "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
    393394
    394395                bp_blogs_record_activity( array(
    395396                    'user_id' => (int)$post->post_author,
    396                     'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
     397                    'action' => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink ),
     398                    'content' => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink ),
    397399                    'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
    398                     'component_action' => 'new_blog_post',
     400                    'type' => 'new_blog_post',
    399401                    'item_id' => $blog_id,
    400402                    'secondary_item_id' => $post_id,
     
    407409
    408410        /* Delete and the activity stream item as we are probably going to re-add it later with new info. */
    409         bp_blogs_delete_activity( array( 'item_id' => $existing_post->id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_post' ) );
     411        bp_blogs_delete_activity( array( 'item_id' => $existing_post->id, 'component' => $bp->blogs->slug, 'type' => 'new_blog_post' ) );
    410412
    411413        /* Delete the recorded post if the status is not published or it is password protected */
     
    426428            $post_permalink = bp_post_get_permalink( $post, $blog_id );
    427429
    428             $activity_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>' );
    429             $activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
     430            $activity_action = 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>' );
     431            $activity_content = "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
    430432
    431433            /* Record this in activity streams */
    432434            bp_blogs_record_activity( array(
    433435                'user_id' => (int)$post->post_author,
    434                 'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
     436                'action' => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink ),
     437                'content' => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink ),
    435438                'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
    436                 'component_action' => 'new_blog_post',
     439                'type' => 'new_blog_post',
    437440                'item_id' => $blog_id,
    438441                'secondary_item_id' => $existing_post->id,
     
    483486        /* Record in activity streams */
    484487        $comment_link = bp_post_get_permalink( $comment->post, $wpdb->blogid ) . '#comment-' . $comment_id;
    485         $activity_content = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' );
    486         $activity_content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
     488        $activity_action = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' );
     489        $activity_content = '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
    487490
    488491        /* Record this in activity streams */
    489492        bp_blogs_record_activity( array(
    490493            'user_id' => $user_id,
    491             'content' => apply_filters( 'bp_blogs_activity_new_comment', $activity_content, &$comment, &$recorded_comment, $comment_link ),
     494            'action' => apply_filters( 'bp_blogs_activity_new_comment_action', $activity_action, &$comment, &$recorded_comment, $comment_link ),
     495            'content' => apply_filters( 'bp_blogs_activity_new_comment_content', $activity_content, &$comment, &$recorded_comment, $comment_link ),
    492496            'primary_link' => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$comment, &$recorded_comment ),
    493             'component_action' => 'new_blog_comment',
     497            'type' => 'new_blog_comment',
    494498            'item_id' => $wpdb->blogid,
    495499            'secondary_item_id' => $comment_id,
     
    530534
    531535    // Delete activity stream item
    532     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog' ) );
     536    bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
    533537
    534538    do_action( 'bp_blogs_remove_blog', $blog_id );
     
    545549
    546550    // Delete activity stream item
    547     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog' ) );
     551    bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
    548552
    549553    do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
     
    566570
    567571    // Delete activity stream item
    568     bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'component_name' => $existing_post->id, 'component_action' => 'new_blog_post' ) );
     572    bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'component' => $existing_post->id, 'type' => 'new_blog_post' ) );
    569573
    570574    do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $post->user_id );
     
    579583
    580584    // Delete activity stream item
    581     bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'secondary_item_id' => $comment_id, 'component_action' => 'new_blog_comment' ) );
     585    bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'secondary_item_id' => $comment_id, 'type' => 'new_blog_comment' ) );
    582586
    583587    do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id, $bp->loggedin_user->id );
     
    608612
    609613    // Delete activity stream item
    610     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => false ) );
     614    bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => false ) );
    611615
    612616    do_action( 'bp_blogs_remove_data_for_blog', $blog_id );
  • trunk/bp-core.php

    r2375 r2381  
    246246
    247247    /* Add names of root components to the banned blog list to avoid conflicts */
    248     bp_core_add_illegal_names();
     248    if ( bp_core_is_multisite() )
     249        bp_core_add_illegal_names();
    249250
    250251    update_site_option( 'bp-core-db-version', BP_CORE_DB_VERSION );
  • trunk/bp-core/bp-core-activation.php

    r2274 r2381  
    5555            bp_activity_add( array(
    5656                'user_id' => $signup['user_id'],
    57                 'content' => apply_filters( 'bp_core_activity_registered_member', sprintf( __( '%s became a registered member', 'buddypress' ), $userlink ), $signup['user_id'] ),
    58                 'primary_link' => apply_filters( 'bp_core_actiivty_registered_member_primary_link', $userlink ),
    59                 'component_name' => 'profile',
    60                 'component_action' => 'new_member'
     57                'action' => apply_filters( 'bp_core_activity_registered_member_action', sprintf( __( '%s became a registered member', 'buddypress' ), $userlink ), $signup['user_id'] ),
     58                'component' => 'profile',
     59                'type' => 'new_member'
    6160            ) );
    6261        }
  • trunk/bp-friends.php

    r2369 r2381  
    269269    $defaults = array(
    270270        'user_id' => $bp->loggedin_user->id,
    271         'content' => false,
    272         'primary_link' => false,
    273         'component_name' => $bp->friends->id,
    274         'component_action' => false,
     271        'action' => '',
     272        'content' => '',
     273        'primary_link' => '',
     274        'component' => $bp->friends->id,
     275        'type' => false,
    275276        'item_id' => false,
    276277        'secondary_item_id' => false,
     
    282283    extract( $r, EXTR_SKIP );
    283284
    284     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 ) );
     285    return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
    285286}
    286287
     
    288289    if ( function_exists('bp_activity_delete_by_item_id') ) {
    289290        extract( (array)$args );
    290         bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component_name' => $bp->friends->id, 'component_action' => $component_action, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
     291        bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component' => $bp->friends->id, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
    291292    }
    292293}
     
    389390
    390391    // Remove the activity stream item for the user who canceled the friendship
    391     friends_delete_activity( array( 'item_id' => $friendship_id, 'component_action' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
     392    friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
    392393
    393394    do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
     
    418419        $initiator_link = bp_core_get_userlink( $friendship->initiator_user_id );
    419420        $friend_link = bp_core_get_userlink( $friendship->friend_user_id );
    420 
    421         $primary_link = apply_filters( 'friends_activity_friendship_accepted_primary_link', bp_core_get_user_domain( $friendship->initiator_user_id ), &$friendship );
    422421
    423422        /* Record in activity streams for the initiator */
    424423        friends_record_activity( array(
    425424            'user_id' => $friendship->initiator_user_id,
    426             'component_action' => 'friendship_created',
    427             'content' => apply_filters( 'friends_activity_friendship_accepted', sprintf( __( '%s and %s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ),
    428             'primary_link' => $primary_link,
     425            'type' => 'friendship_created',
     426            'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ),
    429427            'item_id' => $friendship_id
    430428        ) );
     
    433431        friends_record_activity( array(
    434432            'user_id' => $friendship->friend_user_id,
    435             'component_action' => 'friendship_created',
    436             'content' => apply_filters( 'friends_activity_friendship_accepted', sprintf( __( '%s and %s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ),
    437             'primary_link' => $primary_link,
     433            'type' => 'friendship_created',
     434            'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ),
    438435            'item_id' => $friendship_id,
    439436            'hide_sitewide' => true /* We've already got the first entry site wide */
  • trunk/bp-groups.php

    r2352 r2381  
    306306
    307307            groups_record_activity( array(
    308                 'content' => apply_filters( 'groups_activity_accepted_invite', sprintf( __( '%s joined the group %s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $bp->loggedin_user->id, &$group ),
    309                 'primary_link' => apply_filters( 'groups_activity_accepted_invite_primary_link', bp_get_group_permalink( $group ), &$group ),
    310                 'component_action' => 'joined_group',
     308                'action' => apply_filters( 'groups_activity_accepted_invite_action', sprintf( __( '%s joined the group %s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $bp->loggedin_user->id, &$group ),
     309                'type' => 'joined_group',
    311310                'item_id' => $group->id
    312311            ) );
     
    11551154            /* Once we compelete all steps, record the group creation in the activity stream. */
    11561155            groups_record_activity( array(
    1157                 'content' => apply_filters( 'groups_activity_created_group', sprintf( __( '%s created the group %s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
    1158                 'primary_link' => apply_filters( 'groups_activity_created_group_primary_link', bp_get_group_permalink( $bp->groups->current_group ) ),
    1159                 'component_action' => 'created_group',
     1156                'action' => apply_filters( 'groups_activity_created_group_action', sprintf( __( '%s created the group %s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
     1157                'type' => 'created_group',
    11601158                'item_id' => $bp->groups->new_group_id
    11611159            ) );
     
    13211319    $defaults = array(
    13221320        'user_id' => $bp->loggedin_user->id,
    1323         'content' => false,
    1324         'primary_link' => false,
    1325         'component_name' => $bp->groups->id,
    1326         'component_action' => false,
     1321        'action' => '',
     1322        'content' => '',
     1323        'primary_link' => '',
     1324        'component' => $bp->groups->id,
     1325        'type' => false,
    13271326        'item_id' => false,
    13281327        'secondary_item_id' => false,
     
    13341333    extract( $r, EXTR_SKIP );
    13351334
    1336     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 ) );
     1335    return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
    13371336}
    13381337
     
    16021601    /* Delete all group activity from activity streams */
    16031602    if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
    1604         bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component_name' => $bp->groups->id ) );
     1603        bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component' => $bp->groups->id ) );
    16051604    }
    16061605
     
    17021701    /* Record this in activity streams */
    17031702    groups_record_activity( array(
    1704         'content' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%s joined the group %s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
    1705         'primary_link' => apply_filters( 'groups_activity_joined_group_primary_link', bp_get_group_permalink( $bp->groups->current_group ) ),
    1706         'component_action' => 'joined_group',
     1703        'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%s joined the group %s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
     1704        'type' => 'joined_group',
    17071705        'item_id' => $group_id
    17081706    ) );
     
    18941892
    18951893    /* Record this in activity streams */
    1896     $activity_content = sprintf( __( '%s posted an update in the group %s:', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
    1897     $activity_content .= '<div class="activity-inner">' . $content . '</div>';
     1894    $activity_action = sprintf( __( '%s posted an update in the group %s:', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     1895    $activity_content = '<div class="activity-inner">' . $content . '</div>';
    18981896
    18991897    $activity_id = groups_record_activity( array(
    19001898        'user_id' => $user_id,
     1899        'action' => apply_filters( 'groups_activity_new_update_action', $activity_action ),
    19011900        'content' => apply_filters( 'groups_activity_new_update_content', $activity_content ),
    1902         'primary_link' => apply_filters( 'groups_activity_new_update_primary_link', bp_get_group_permalink( $bp->groups->current_group ) ),
    1903         'component_action' => 'activity_update',
     1901        'type' => 'activity_update',
    19041902        'item_id' => $bp->groups->current_group->id
    19051903    ) );
     
    19411939        $topic = bp_forums_get_topic_details( $topic_id );
    19421940
    1943         $activity_content = sprintf( __( '%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<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>' );
    1944         $activity_content .= '<blockquote>' . bp_create_excerpt( $post_text ) . '</blockquote>';
     1941        $activity_action = sprintf( __( '%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<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>' );
     1942        $activity_content = '<blockquote>' . bp_create_excerpt( $post_text ) . '</blockquote>';
    19451943
    19461944        /* Record this in activity streams */
    19471945        groups_record_activity( array(
    1948             'content' => apply_filters( 'groups_activity_new_forum_post', $activity_content, $post_text, &$topic, &$forum_post ),
     1946            'action' => apply_filters( 'groups_activity_new_forum_post_action', $activity_action, $post_text, &$topic, &$forum_post ),
     1947            'content' => apply_filters( 'groups_activity_new_forum_post_content', $activity_content, $post_text, &$topic, &$forum_post ),
    19491948            'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ),
    1950             'component_action' => 'new_forum_post',
     1949            'type' => 'new_forum_post',
    19511950            'item_id' => $bp->groups->current_group->id,
    19521951            'secondary_item_id' => $forum_post
     
    19751974        $topic = bp_forums_get_topic_details( $topic_id );
    19761975
    1977         $activity_content = sprintf( __( '%s started the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<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>' );
    1978         $activity_content .= '<blockquote>' . bp_create_excerpt( $topic_text ) . '</blockquote>';
     1976        $activity_action = sprintf( __( '%s started the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<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>' );
     1977        $activity_content = '<blockquote>' . bp_create_excerpt( $topic_text ) . '</blockquote>';
    19791978
    19801979        /* Record this in activity streams */
    19811980        groups_record_activity( array(
    1982             'content' => apply_filters( 'groups_activity_new_forum_topic', $activity_content, $topic_text, &$topic ),
     1981            'action' => apply_filters( 'groups_activity_new_forum_topic_action', $activity_action, $topic_text, &$topic ),
     1982            'content' => apply_filters( 'groups_activity_new_forum_topic_content', $activity_content, $topic_text, &$topic ),
    19831983            'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ),
    1984             'component_action' => 'new_forum_topic',
     1984            'type' => 'new_forum_topic',
    19851985            'item_id' => $bp->groups->current_group->id,
    19861986            'secondary_item_id' => $topic->topic_id
     
    20042004        /* Update the activity stream item */
    20052005        if ( function_exists( 'bp_activity_delete_by_item_id' ) )
    2006             bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component_name' => $bp->groups->id, 'component_action' => 'new_forum_topic' ) );
    2007 
    2008         $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>' );
    2009         $activity_content .= '<blockquote>' . bp_create_excerpt( $topic_text ) . '</blockquote>';
     2006            bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
     2007
     2008        $activity_action = 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>' );
     2009        $activity_content = '<blockquote>' . bp_create_excerpt( $topic_text ) . '</blockquote>';
    20102010
    20112011        /* Record this in activity streams */
    20122012        groups_record_activity( array(
    2013             'content' => apply_filters( 'groups_activity_new_forum_topic', $activity_content, $topic_text, &$topic ),
     2013            'action' => apply_filters( 'groups_activity_new_forum_topic_action', $activity_action, $topic_text, &$topic ),
     2014            'content' => apply_filters( 'groups_activity_new_forum_topic_content', $activity_content, $topic_text, &$topic ),
    20142015            'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ),
    2015             'component_action' => 'new_forum_topic',
     2016            'type' => 'new_forum_topic',
    20162017            'item_id' => (int)$bp->groups->current_group->id,
    20172018            'user_id' => (int)$topic->topic_poster,
     
    20412042        /* Update the activity stream item */
    20422043        if ( function_exists( 'bp_activity_delete_by_item_id' ) )
    2043             bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id, 'component_name' => $bp->groups->id, 'component_action' => 'new_forum_post' ) );
    2044 
    2045         $activity_content = sprintf( __( '%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<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>' );
    2046         $activity_content .= '<blockquote>' . bp_create_excerpt( $post_text ) . '</blockquote>';
     2044            bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post' ) );
     2045
     2046        $activity_action = sprintf( __( '%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<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>' );
     2047        $activity_content = '<blockquote>' . bp_create_excerpt( $post_text ) . '</blockquote>';
    20472048
    20482049        /* Record this in activity streams */
    20492050        groups_record_activity( array(
    2050             'content' => apply_filters( 'groups_activity_new_forum_post', $activity_content, $post_text, &$topic, &$forum_post ),
     2051            'action' => apply_filters( 'groups_activity_new_forum_post_action', $activity_action, $post_text, &$topic, &$forum_post ),
     2052            'content' => apply_filters( 'groups_activity_new_forum_post_content', $activity_content, $post_text, &$topic, &$forum_post ),
    20512053            'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', bp_get_group_permalink( $bp->groups->current_group ) ),
    2052             'component_action' => 'new_forum_post',
     2054            'type' => 'new_forum_post',
    20532055            'item_id' => (int)$bp->groups->current_group->id,
    20542056            'user_id' => (int)$post->poster_id,
     
    20712073        /* Delete the activity stream item */
    20722074        if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
    2073             bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => $bp->groups->id, 'component_action' => 'new_forum_topic' ) );
    2074             bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => $bp->groups->id, 'component_action' => 'new_forum_post' ) );
     2075            bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
     2076            bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post' ) );
    20752077        }
    20762078
     
    20892091        /* Delete the activity stream item */
    20902092        if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
    2091             bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id, 'component_name' => $bp->groups->id, 'component_action' => 'new_forum_post' ) );
     2093            bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post' ) );
    20922094        }
    20932095
     
    23442346
    23452347    groups_record_activity( array(
    2346         'content' => apply_filters( 'groups_activity_membership_accepted', sprintf( __( '%s joined the group %s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $user_id, &$group ),
    2347         'primary_link' => apply_filters( 'groups_activity_membership_accepted_primary_link', bp_get_group_permalink( $group ), &$group ),
    2348         'component_action' => 'joined_group',
     2348        'action' => apply_filters( 'groups_activity_membership_accepted_action', sprintf( __( '%s joined the group %s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $user_id, &$group ),
     2349        'type' => 'joined_group',
    23492350        'item_id' => $group->id,
    23502351        'user_id' => $user_id
  • trunk/bp-themes/bp-default/_inc/css/default.css

    r2376 r2381  
    14831483div.post {
    14841484    margin: 0 0 60px 0;
     1485    overflow: auto;
    14851486}
    14861487    div.post div.author-box, div.comment-avatar-box {
     
    15071508        font-size: 26px;
    15081509        margin-bottom: 5px;
     1510        margin-top: 0;
    15091511        line-height: 120%;
    15101512    }
     
    15261528    div.post p.postmetadata {
    15271529        margin-top: 15px;
     1530        clear: left;
    15281531        overflow: hidden;
    15291532    }
  • trunk/bp-themes/bp-default/_inc/global.js

    r2378 r2381  
    287287            /* Update the feed link */
    288288            if ( null != response.feed_url )
    289                 j('div#subnav li.feed a').attr('href', response.feed_url);
     289                j('.directory div#subnav li.feed a').attr('href', response.feed_url);
    290290
    291291            j('div.item-list-tabs li.selected').removeClass('loading');
  • trunk/bp-themes/bp-default/activity/entry.php

    r2363 r2381  
    3030    </div>
    3131
    32     <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
     32    <?php if ( 'activity_comment' == bp_get_activity_type() ) : ?>
    3333        <div class="activity-inreplyto">
    3434            <strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> - <?php bp_activity_parent_content() ?> &middot;
  • trunk/bp-themes/bp-default/activity/index.php

    r2344 r2381  
    7272                    // If you're concerned about no-script functionality, uncomment the following line.
    7373
    74                     // locate_template( array( 'activity/activity-loop.php' ), true );
     74                    //locate_template( array( 'activity/activity-loop.php' ), true );
    7575                ?>
    7676            </div><!-- .activity -->
  • trunk/bp-themes/bp-sn-parent/_inc/ajax.php

    r2344 r2381  
    449449            'content' => apply_filters( 'xprofile_activity_update', $activity_content, &$wire_post ),
    450450            'primary_link' => apply_filters( 'xprofile_activity_update_primary_link', $primary_link ),
    451             'component_action' => 'activity_update'
     451            'type' => 'activity_update'
    452452        ) );
    453453
     
    464464            'content' => apply_filters( 'groups_activity_update', $activity_content ),
    465465            'primary_link' => apply_filters( 'groups_activity_update_primary_link', bp_get_group_permalink( $bp->groups->current_group ) ),
    466             'component_action' => 'activity_update',
     466            'type' => 'activity_update',
    467467            'item_id' => $item_id
    468468        ) );
     
    512512        'content' => apply_filters( 'bp_activity_comment_content', $comment_header . '<div class="activity-inner">' . $_POST['content'] . '</div>' ),
    513513        'primary_link' => '',
    514         'component_name' => $bp->activity->id,
    515         'component_action' => 'activity_comment',
     514        'component' => $bp->activity->id,
     515        'type' => 'activity_comment',
    516516        'user_id' => $bp->loggedin_user->id,
    517517        'item_id' => $_POST['form_id'],
  • trunk/bp-xprofile.php

    r2359 r2381  
    484484    $defaults = array(
    485485        'user_id' => $bp->loggedin_user->id,
    486         'content' => false,
    487         'primary_link' => false,
    488         'component_name' => $bp->profile->id,
    489         'component_action' => false,
     486        'action' => '',
     487        'content' => '',
     488        'primary_link' => '',
     489        'component' => $bp->profile->id,
     490        'type' => false,
    490491        'item_id' => false,
    491492        'secondary_item_id' => false,
     
    497498    extract( $r, EXTR_SKIP );
    498499
    499     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 ) );
     500    return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
    500501}
    501502
     
    516517    if ( function_exists('bp_activity_delete_by_item_id') ) {
    517518        extract($args);
    518         bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component_name' => $bp->profile->id, 'component_action' => $component_action, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
     519        bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component' => $bp->profile->id, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
    519520    }
    520521}
Note: See TracChangeset for help on using the changeset viewer.