Skip to:
Content

BuddyPress.org

Changeset 2287 for trunk/bp-activity.php


Ignore:
Timestamp:
01/10/2010 08:42:42 PM (16 years ago)
Author:
apeatling
Message:

Shifted the filter select from the main activity page tab row onto a second row to accommodate the missing feed link (links will be altered on an upcoming commit). Added a mentions tab. Tweaked a couple of css styles and ID's for better re-use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r2285 r2287  
    194194
    195195function bp_activity_screen_notification_settings() {
    196     global $current_user; ?>
     196    global $bp; ?>
    197197    <table class="notification-settings" id="activity-notification-settings">
    198198        <tr>
     
    205205        <tr>
    206206            <td></td>
    207             <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), $current_user->user_login ) ?></td>
    208             <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_activity_new_mention' ) || 'yes' == get_usermeta( $current_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
    209             <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
     207            <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ?></td>
     208            <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) || 'yes' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
     209            <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
    210210        </tr>
    211211        <tr>
    212212            <td></td>
    213213            <td><?php printf( __( "A member replies to an update you've posted", 'buddypress' ), $current_user->user_login ) ?></td>
    214             <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_activity_new_reply' ) || 'yes' == get_usermeta( $current_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
    215             <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
     214            <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) || 'yes' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
     215            <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
    216216        </tr>
    217217
     
    444444}
    445445
     446function bp_activity_post_update( $args = '' ) {
     447    global $bp;
     448
     449    $defaults = array(
     450        'content' => false,
     451        'user_id' => $bp->loggedin_user->id
     452    );
     453
     454    $r = wp_parse_args( $args, $defaults );
     455    extract( $r, EXTR_SKIP );
     456
     457    if ( empty($content) || empty($content) )
     458        return false;
     459
     460    /* Record this on the user's profile */
     461    $from_user_link = bp_core_get_userlink( $user_id );
     462    $activity_content = sprintf( __('%s posted an update:', 'buddypress'), $from_user_link );
     463    $activity_content .= '<div class="activity-inner">' . $content . '</div>';
     464
     465    $primary_link = bp_core_get_userlink( $user_id, false, true );
     466
     467    /* Now write the values */
     468    $activity_id = bp_activity_add( array(
     469        'user_id' => $user_id,
     470        'content' => apply_filters( 'bp_activity_new_update_content', $activity_content ),
     471        'primary_link' => apply_filters( 'bp_activity_new_update_primary_link', $primary_link ),
     472        'component_name' => $bp->activity->id,
     473        'component_action' => 'new_wire_post'
     474    ) );
     475
     476    /* Add this update to the "latest update" usermeta so it can be fetched anywhere. */
     477    update_usermeta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
     478
     479    do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
     480
     481    return $activity_id;
     482}
     483
    446484function bp_activity_new_comment( $args = '' ) {
    447485    global $bp;
Note: See TracChangeset for help on using the changeset viewer.