Skip to:
Content

BuddyPress.org

Changeset 1621 for trunk/bp-activity.php


Ignore:
Timestamp:
07/21/2009 09:45:28 PM (15 years ago)
Author:
apeatling
Message:

Completely re-wrote the forums component. No longer needs an external setup of bbPress. bbPress is included as an external that can be set up with one click for new installations. Existing bbPress installs, or BuddyPress upgrades can use the "use existing install" option and provide the location of their bb-config.php file.

Added complete forum management for group mods and admins (sticky/delete/close/edit) and edit/delete for group members on their own posts. Make sure you update your theme with the new template files in the /groups/ directory to get access to these features.

The "use existing install" option needs testing before it can become reliable. Expect changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r1599 r1621  
    189189    extract( $r, EXTR_SKIP );
    190190   
     191    /* Insert the "time-since" placeholder */
     192    if ( $content ) {
     193        if ( !$pos = strpos( $content, '<blockquote' ) ) {
     194            if ( !$pos = strpos( $content, '<div' ) ) {
     195                if ( !$pos = strpos( $content, '<ul' ) ) {
     196                    $content .= ' <span class="time-since">%s</span>';
     197                }
     198            }
     199        }
     200       
     201        if ( $pos ) {
     202            $before = substr( $content, 0, $pos );
     203            $after = substr( $content, $pos, strlen( $content ) );
     204           
     205            $content = $before . ' <span class="time-since">%s</span>' . $after;
     206        }
     207    }
     208
    191209    $activity = new BP_Activity_Activity;
    192210    $activity->user_id = $user_id;
     
    208226}
    209227
    210 function bp_activity_update( $args = '' ) {
    211     global $bp, $wpdb;
    212    
    213     extract( $args );
    214    
     228/* There are multiple ways to delete activity items, depending on the information you have at the time. */
     229
     230function bp_activity_delete_by_item_id( $args = '' ) {
     231    global $bp;
     232
    215233    $defaults = array(
    216         'user_id' => $bp->loggedin_user->id,
    217         'content' => false,
     234        'item_id' => false,
    218235        'component_name' => false,
    219236        'component_action' => false,
    220         'item_id' => false,
    221         'secondary_item_id' => false,
    222         'recorded_time' => time(),
    223         'hide_sitewide' => false
     237        'user_id' => false, // optional
     238        'secondary_item_id' => false // optional
    224239    );
    225240
    226241    $r = wp_parse_args( $args, $defaults );
    227242    extract( $r, EXTR_SKIP );
    228        
    229     $activity = new BP_Activity_Activity( $user_id, $component_name, $component_action, $item_id, $secondary_item_id );
    230     $activity->user_id = $user_id;
    231     $activity->content = $content;
    232     $activity->primary_link = $primary_link;
    233     $activity->component_name = $component_name;
    234     $activity->component_action = $component_action;
    235     $activity->item_id = $item_id;
    236     $activity->secondary_item_id = $secondary_item_id;
    237     $activity->date_recorded = $recorded_time;
    238     $activity->hide_sitewide = $hide_sitewide;
    239        
    240     if ( !$activity->save() )
    241         return false;
    242 
    243     do_action( 'bp_activity_update', $args );
    244    
    245     return true;
    246 }
    247 
    248 /* There are multiple ways to delete activity items, depending on the information you have at the time. */
    249 
    250 function bp_activity_delete_by_item_id( $user_id, $component_name, $component_action, $item_id, $secondary_item_id = false ) { 
    251     if ( !BP_Activity_Activity::delete_by_item_id( $user_id, $component_name, $component_action, $item_id, $secondary_item_id ) )
    252         return false;
    253 
    254     do_action( 'bp_activity_delete_by_item_id', $user_id, $component_name, $component_action, $item_id, $secondary_item_id );
     243
     244    if ( !BP_Activity_Activity::delete_by_item_id( $item_id, $component_name, $component_action, $user_id, $secondary_item_id ) )
     245        return false;
     246
     247    do_action( 'bp_activity_delete_by_item_id', $item_id, $component_name, $component_action, $user_id, $secondary_item_id );
    255248
    256249    return true;
     
    345338/* DEPRECATED - use bp_activity_delete_by_item_id() */
    346339function bp_activity_delete( $item_id, $component_name, $component_action, $user_id, $secondary_item_id ) {
    347     if ( !bp_activity_delete_by_item_id( $user_id, $component_name, $component_action, $item_id, $secondary_item_id ) )
     340    if ( !bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component_name' => $component_name, 'component_action' => $component_action, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) ) )
    348341        return false;
    349342       
Note: See TracChangeset for help on using the changeset viewer.