Changeset 4177
- Timestamp:
- 04/08/2011 09:43:12 PM (14 years ago)
- Location:
- trunk/bp-xprofile
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-functions.php
r4121 r4177 1 1 <?php 2 3 /*******************************************************************************4 * These functions handle the recording, deleting and formatting of activity and5 * notifications for the user and for this specific component.6 */7 8 function xprofile_register_activity_actions() {9 global $bp;10 11 if ( bp_is_active( 'activity' ) )12 return false;13 14 // Register the activity stream actions for this component15 bp_activity_set_action( $bp->profile->id, 'new_member', __( 'New member registered', 'buddypress' ) );16 bp_activity_set_action( $bp->profile->id, 'updated_profile', __( 'Updated Profile', 'buddypress' ) );17 18 do_action( 'xprofile_register_activity_actions' );19 }20 add_action( 'bp_register_activity_actions', 'xprofile_register_activity_actions' );21 22 /**23 * Records activity for the logged in user within the profile component so that24 * it will show in the users activity stream (if installed)25 *26 * @package BuddyPress XProfile27 * @param $args Array containing all variables used after extract() call28 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()29 * @uses bp_activity_record() Adds an entry to the activity component tables for a specific activity30 */31 function xprofile_record_activity( $args = true ) {32 global $bp;33 34 if ( !bp_is_active( 'activity' ) )35 return false;36 37 $defaults = array (38 'user_id' => $bp->loggedin_user->id,39 'action' => '',40 'content' => '',41 'primary_link' => '',42 'component' => $bp->profile->id,43 'type' => false,44 'item_id' => false,45 'secondary_item_id' => false,46 'recorded_time' => bp_core_current_time(),47 'hide_sitewide' => false48 );49 50 $r = wp_parse_args( $args, $defaults );51 extract( $r, EXTR_SKIP );52 53 return bp_activity_add( array(54 'user_id' => $user_id,55 'action' => $action,56 'content' => $content,57 'primary_link' => $primary_link,58 'component' => $component,59 'type' => $type,60 'item_id' => $item_id,61 'secondary_item_id' => $secondary_item_id,62 'recorded_time' => $recorded_time,63 'hide_sitewide' => $hide_sitewide64 ) );65 }66 67 /**68 * Deletes activity for a user within the profile component so that69 * it will be removed from the users activity stream and sitewide stream (if installed)70 *71 * @package BuddyPress XProfile72 * @param $args Array containing all variables used after extract() call73 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()74 * @uses bp_activity_delete() Deletes an entry to the activity component tables for a specific activity75 */76 function xprofile_delete_activity( $args = '' ) {77 global $bp;78 79 if ( bp_is_active( 'activity' ) ) {80 81 extract( $args );82 83 bp_activity_delete_by_item_id( array(84 'item_id' => $item_id,85 'component' => $bp->profile->id,86 'type' => $type,87 'user_id' => $user_id,88 'secondary_item_id' => $secondary_item_id89 ) );90 }91 }92 93 function xprofile_register_activity_action( $key, $value ) {94 global $bp;95 96 if ( !bp_is_active( 'activity' ) )97 return false;98 99 return apply_filters( 'xprofile_register_activity_action', bp_activity_set_action( $bp->profile->id, $key, $value ), $key, $value );100 }101 102 103 2 /******************************************************************************** 104 3 * Business Functions … … 680 579 return bp_xprofile_update_meta( $field_data_id, 'data', $meta_key, $meta_value ); 681 580 } 682 683 581 ?>
Note: See TracChangeset
for help on using the changeset viewer.