Changeset 2287
- Timestamp:
- 01/10/2010 08:42:42 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r2285 r2287 194 194 195 195 function bp_activity_screen_notification_settings() { 196 global $ current_user; ?>196 global $bp; ?> 197 197 <table class="notification-settings" id="activity-notification-settings"> 198 198 <tr> … … 205 205 <tr> 206 206 <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> 210 210 </tr> 211 211 <tr> 212 212 <td></td> 213 213 <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> 216 216 </tr> 217 217 … … 444 444 } 445 445 446 function 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 446 484 function bp_activity_new_comment( $args = '' ) { 447 485 global $bp; -
trunk/bp-activity/bp-activity-filters.php
r2270 r2287 74 74 75 75 foreach( (array)$usernames as $username ) { 76 if ( ! username_exists( $username ) )76 if ( !$user_id = username_exists( $username ) ) 77 77 continue; 78 79 /* Increase the number of new @ mentions for the user */ 80 $new_mention_count = (int)get_usermeta( $user_id, 'bp_new_mention_count' ); 81 update_usermeta( $user_id, 'bp_new_mention_count', $new_mention_count + 1 ); 78 82 79 83 $content = str_replace( "@$username", "<a href='" . bp_core_get_user_domain( bp_core_get_userid( $username ) ) . "' rel='nofollow'>@$username</a>", $content ); … … 82 86 return $content; 83 87 } 84 add_filter( ' xprofile_activity_new_update_content', 'bp_activity_at_name_filter' );88 add_filter( 'bp_activity_new_update_content', 'bp_activity_at_name_filter' ); 85 89 add_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' ); 86 90 add_filter( 'bp_activity_comment_content', 'bp_activity_at_name_filter' ); -
trunk/bp-activity/bp-activity-notifications.php
r2277 r2287 1 1 <?php 2 3 function bp_activity_at_message_notification( $content, $poster_user_id, $activity_id ) { 4 global $bp; 5 6 /* Scan for @username strings in an activity update. Notify each user. */ 7 $pattern = '/[@]+([A-Za-z0-9-_]+)/'; 8 preg_match_all( $pattern, $content, $usernames ); 9 10 /* Make sure there's only one instance of each username */ 11 if ( !$usernames = array_unique( $usernames[1] ) ) 12 return false; 13 14 foreach( (array)$usernames as $username ) { 15 if ( !$receiver_user_id = bp_core_get_userid($username) ) 16 continue; 17 18 // Add a screen notification of an @message 19 bp_core_add_notification( $activity_id, $receiver_user_id, $bp->activity->id, 'new_at_mention', $poster_user_id ); 20 21 // Now email the user with the contents of the message (if they have enabled email notifications) 22 if ( !get_usermeta( $user_id, 'notification_activity_new_mention' ) || 'yes' == get_usermeta( $user_id, 'notification_activity_new_mention' ) ) { 23 $poster_name = bp_core_get_user_displayname( $poster_user_id ); 24 25 $message_link = bp_activity_get_permalink( $activity_id ); 26 $settings_link = bp_core_get_user_domain( $user_id ) . 'settings/notifications/'; 27 28 // Set up and send the message 29 $ud = get_userdata( $receiver_user_id ); 30 $to = $ud->user_email; 31 $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), stripslashes($poster_name) ); 32 33 $message = sprintf( __( 34 '%s mentioned you in an update: 35 36 "%s" 37 38 To view and respond to the message, log in and visit: %s 39 40 --------------------- 41 ', 'buddypress' ), $poster_name, wp_filter_kses( stripslashes($content) ), $message_link ); 42 43 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link ); 44 45 // Send it 46 wp_mail( $to, $subject, $message ); 47 } 48 } 49 } 50 add_action( 'bp_activity_posted_update', 'bp_activity_at_message_notification', 10, 3 ); 2 51 3 52 function bp_activity_new_comment_notification( $comment_id, $params ) { -
trunk/bp-activity/bp-activity-templatetags.php
r2277 r2287 666 666 } 667 667 668 function bp_total_mention_count_for_user( $user_id = false ) { 669 echo bp_get_total_favorite_count_for_user( $user_id ); 670 } 671 function bp_get_total_mention_count_for_user( $user_id = false ) { 672 return apply_filters( 'bp_get_total_mention_count_for_user', get_usermeta( $user_id, 'bp_new_mention_count' ) ); 673 } 674 668 675 function bp_send_public_message_link() { 669 676 echo bp_get_send_public_message_link(); … … 672 679 global $bp; 673 680 674 return apply_filters( 'bp_get_send_public_message_link', $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . $bp->displayed_user->userdata->user_login ); 675 } 681 return apply_filters( 'bp_get_send_public_message_link', $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ); 682 } 683 676 684 677 685 /* RSS Feed Template Tags ***************************/ -
trunk/bp-messages/bp-messages-templatetags.php
r2276 r2287 442 442 global $bp; 443 443 444 return apply_filters( 'bp_get_send_public_message_link', $bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . $bp->displayed_user->userdata->user_login);444 return apply_filters( 'bp_get_send_public_message_link', $bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ); 445 445 } 446 446 … … 454 454 return false; 455 455 456 return apply_filters( 'bp_get_send_message_button', '<div class="generic-button"><a class="send-message" title="' . __( 'Send Message', 'buddypress' ) . '" href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . $bp->displayed_user->userdata->user_login. '">' . __( 'Send Message', 'buddypress' ) . '</a></div>' );456 return apply_filters( 'bp_get_send_message_button', '<div class="generic-button"><a class="send-message" title="' . __( 'Send Message', 'buddypress' ) . '" href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) . '">' . __( 'Send Message', 'buddypress' ) . '</a></div>' ); 457 457 } 458 458 -
trunk/bp-themes/bp-default/_inc/ajax.php
r2268 r2287 71 71 )); 72 72 } else { 73 $activity_id = xprofile_post_update( array(73 $activity_id = bp_activity_post_update( array( 74 74 'content' => $_POST['content'] 75 75 )); … … 169 169 $query_string = 'user_id=' . $bp->displayed_user->id; 170 170 } else { 171 /* Set a valid type */ 172 if ( !$type || ( 'all' != $type && 'friends' != $type && 'groups' != $type && 'favorites' != $type ) ) 173 $type = 'all'; 174 175 if ( ( 'friends' == $type || 'groups' == $type || 'favorites' == $type ) && !is_user_logged_in() ) 171 /* Make sure a type is set. */ 172 if ( empty($type) ) 176 173 $type = 'all'; 177 174 … … 195 192 $query_string = 'include=' . $favorite_ids; 196 193 break; 194 case 'atme': 195 $query_string = 'search_terms=@' . bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ); 196 197 /* Reset the number of new @ mentions for the user */ 198 delete_usermeta( $bp->loggedin_user->id, 'bp_new_mention_count' ); 199 break; 197 200 } 198 201 } -
trunk/bp-themes/bp-default/_inc/css/default.css
r2279 r2287 493 493 } 494 494 495 div.item-list-tabs#user-subnav, 496 div.item-list-tabs#group-subnav { 495 div.item-list-tabs#subnav { 497 496 background: #fff; 498 497 margin: 0 -15px 15px -15px; -
trunk/bp-themes/bp-default/_inc/global.js
r2284 r2287 97 97 98 98 /* List tabs event delegation */ 99 j('div. item-list-tabs').click( function(event) {99 j('div.activity-type-tabs').click( function(event) { 100 100 var target = j(event.target).parent(); 101 101 102 102 /* Activity Stream Tabs */ 103 if ( target.attr('id') == 'activity-all' || 104 target.attr('id') == 'activity-friends' || 105 target.attr('id') == 'activity-groups' || 106 target.attr('id') == 'activity-favorites' ) { 107 108 var type = target.attr('id').substr( 9, target.attr('id').length ); 109 var filter = j("#activity-filter-select select").val(); 110 111 bp_activity_request(type, filter, target); 112 113 return false; 114 } 103 var type = target.attr('id').substr( 9, target.attr('id').length ); 104 var filter = j("#activity-filter-select select").val(); 105 106 if ( type == 'atme' ) 107 j( 'li#' + target.attr('id') + ' a strong' ).remove(); 108 109 bp_activity_request(type, filter, target); 110 111 return false; 115 112 }); 116 113 117 114 /* Activity filter select */ 118 115 j('#activity-filter-select select').change( function() { 119 var selected_tab = j( ' .' + j(this).parent().parent().parent().attr('class') + ' li.selected');116 var selected_tab = j( 'div.activity-type-tabs li.selected' ); 120 117 121 118 if ( !selected_tab.length ) … … 158 155 if ( 'fav' == type ) { 159 156 if ( !j('div.item-list-tabs li#activity-favorites').length ) 160 j('div.item-list-tabs ul ').append( '<li id="activity-favorites"><a href="">My Favorites (<span>0</span>)</a></li>');157 j('div.item-list-tabs ul li#activity-atme').before( '<li id="activity-favorites"><a href="">My Favorites (<span>0</span>)</a></li>'); 161 158 162 159 target.removeClass('fav'); -
trunk/bp-themes/bp-default/activity/activity-loop.php
r2284 r2287 25 25 <?php else : ?> 26 26 <div id="message" class="info"> 27 <p><?php _e( ' No activity found.', 'buddypress' ) ?></p>27 <p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ) ?></p> 28 28 </div> 29 29 <?php endif; ?> -
trunk/bp-themes/bp-default/activity/index.php
r2284 r2287 16 16 <?php do_action( 'template_notices' ) ?> 17 17 18 <div class="item-list-tabs ">18 <div class="item-list-tabs activity-type-tabs"> 19 19 <ul> 20 <li class="selected" id="activity-all"><a href="<?php bp_root_domain() ?>" ><?php printf( __( 'All Members (%s)', 'buddypress' ), bp_get_total_site_member_count() ) ?></a></li>20 <li class="selected" id="activity-all"><a href="<?php bp_root_domain() ?>" title="<?php _e( 'The public activity for everyone on this site.', 'buddypress' ) ?>"><?php printf( __( 'All Members (%s)', 'buddypress' ), bp_get_total_site_member_count() ) ?></a></li> 21 21 22 22 <?php if ( is_user_logged_in() ) : ?> 23 23 24 24 <?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?> 25 <li id="activity-friends"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/my-friends/'?>"><?php printf( __( 'My Friends (%s)', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ) ?></a></li>25 <li id="activity-friends"><a href="<?php echo site_url( BP_ACTIVITY_SLUG . '/#my-friends/' ) ?>" title="<?php _e( 'The activity of my friends only.', 'buddypress' ) ?>"><?php printf( __( 'My Friends (%s)', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ) ?></a></li> 26 26 <?php endif; ?> 27 27 28 28 <?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?> 29 <li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/my-groups/'?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>29 <li id="activity-groups"><a href="<?php echo site_url( BP_ACTIVITY_SLUG . '/#my-groups/' ) ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ) ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li> 30 30 <?php endif; ?> 31 31 32 32 <?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?> 33 <li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/my-favorites/'?>"><?php printf( __( 'My Favorites (<span>%s</span>)', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>33 <li id="activity-favorites"><a href="<?php echo site_url( BP_ACTIVITY_SLUG . '/#my-favorites/' ) ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ) ?>"><?php printf( __( 'My Favorites (<span>%s</span>)', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) ?></a></li> 34 34 <?php endif; ?> 35 36 <li id="activity-atme"><a href="<?php echo site_url( BP_ACTIVITY_SLUG . '/#atme/' ) ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li> 35 37 36 38 <?php endif; ?> 37 39 38 40 <?php do_action( 'bp_activity_type_tabs' ) ?> 41 </ul> 42 </div><!-- .item-list-tabs --> 43 44 <div class="item-list-tabs no-ajax" id="subnav"> 45 <ul> 46 <li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="RSS Feed"><?php _e( 'RSS', 'buddypress' ) ?></a></li> 47 48 <?php do_action( 'bp_activity_syndication_options' ) ?> 39 49 40 50 <li id="activity-filter-select" class="last"> -
trunk/bp-themes/bp-default/functions.php
r2284 r2287 65 65 66 66 if ( $comment->user_id ) 67 $userlink = bp_core_get_user url( $comment->user_id );67 $userlink = bp_core_get_user_domain( $comment->user_id ); 68 68 69 69 if ( $comment_type == 'comment' ) { ?> -
trunk/bp-themes/bp-default/groups/single/activity.php
r2284 r2287 1 <div class="item-list-tabs no-ajax" id=" user-subnav">1 <div class="item-list-tabs no-ajax" id="subnav"> 2 2 <ul> 3 3 <li class="feed"><a href="<?php bp_group_activity_feed_link() ?>" title="RSS Feed"><?php _e( 'RSS', 'buddypress' ) ?></a></li> -
trunk/bp-themes/bp-default/groups/single/admin.php
r2284 r2287 1 <div class="item-list-tabs no-ajax" id=" group-subnav">1 <div class="item-list-tabs no-ajax" id="subnav"> 2 2 <ul> 3 3 <?php bp_group_admin_tabs(); ?> -
trunk/bp-themes/bp-default/groups/single/home.php
r2284 r2287 12 12 13 13 <div id="item-nav"> 14 <div class="item-list-tabs no-ajax" id=" group-nav">14 <div class="item-list-tabs no-ajax" id="sub-nav"> 15 15 <ul> 16 16 <?php bp_get_options_nav() ?> -
trunk/bp-themes/bp-default/groups/single/plugins.php
r2284 r2287 12 12 13 13 <div id="item-nav"> 14 <div class="item-list-tabs no-ajax" id=" group-nav">14 <div class="item-list-tabs no-ajax" id="sub-nav"> 15 15 <ul> 16 16 <?php bp_get_options_nav() ?> … … 23 23 <div id="item-body"> 24 24 25 <div class="item-list-tabs no-ajax" id=" group-subnav">25 <div class="item-list-tabs no-ajax" id="subnav"> 26 26 <ul> 27 27 <?php bp_get_options_nav() ?> -
trunk/bp-themes/bp-default/members/single/activity.php
r2284 r2287 1 <div class="item-list-tabs no-ajax" id=" user-subnav">1 <div class="item-list-tabs no-ajax" id="subnav"> 2 2 <ul> 3 3 <li class="feed"><a href="<?php bp_activities_member_rss_link() ?>" title="RSS Feed"><?php _e( 'RSS', 'buddypress' ) ?></a></li> -
trunk/bp-themes/bp-default/members/single/blogs.php
r2284 r2287 1 <div class="item-list-tabs" id=" user-subnav">1 <div class="item-list-tabs" id="subnav"> 2 2 <ul> 3 3 <li id="blogs-filter-select" class="last filter"> -
trunk/bp-themes/bp-default/members/single/friends.php
r2284 r2287 1 <div class="item-list-tabs no-ajax" id=" user-subnav">1 <div class="item-list-tabs no-ajax" id="subnav"> 2 2 <ul> 3 3 <?php if ( bp_is_my_profile() ) : ?> -
trunk/bp-themes/bp-default/members/single/groups.php
r2284 r2287 1 <div class="item-list-tabs no-ajax" id=" user-subnav">1 <div class="item-list-tabs no-ajax" id="subnav"> 2 2 <ul> 3 3 <?php if ( bp_is_my_profile() ) : ?> -
trunk/bp-themes/bp-default/members/single/messages.php
r2284 r2287 1 <div class="item-list-tabs no-ajax" id=" user-subnav">1 <div class="item-list-tabs no-ajax" id="subnav"> 2 2 <ul> 3 3 <?php bp_get_options_nav() ?> -
trunk/bp-themes/bp-default/members/single/plugins.php
r2284 r2287 11 11 12 12 <div id="item-nav"> 13 <div class="item-list-tabs no-ajax" id=" user-nav">13 <div class="item-list-tabs no-ajax" id="sub-nav"> 14 14 <ul> 15 15 <?php bp_get_user_nav() ?> … … 22 22 <div id="item-body"> 23 23 24 <div class="item-list-tabs no-ajax" id=" user-subnav">24 <div class="item-list-tabs no-ajax" id="subnav"> 25 25 <ul> 26 26 <?php bp_get_options_nav() ?> -
trunk/bp-themes/bp-default/members/single/profile.php
r2284 r2287 1 1 <?php if ( bp_is_my_profile() ) : ?> 2 <div class="item-list-tabs no-ajax" id=" user-subnav">2 <div class="item-list-tabs no-ajax" id="subnav"> 3 3 <ul> 4 4 <?php bp_get_options_nav() ?> -
trunk/bp-xprofile.php
r2284 r2287 753 753 */ 754 754 755 function xprofile_post_update( $args = '' ) {756 global $bp;757 758 $defaults = array(759 'content' => false,760 'user_id' => $bp->loggedin_user->id761 );762 763 $r = wp_parse_args( $args, $defaults );764 extract( $r, EXTR_SKIP );765 766 if ( empty($content) || empty($content) )767 return false;768 769 /* Record this on the user's profile */770 $from_user_link = bp_core_get_userlink( $user_id );771 $activity_content = sprintf( __('%s posted an update:', 'buddypress'), $from_user_link );772 $activity_content .= '<div class="activity-inner">' . $content . '</div>';773 774 $primary_link = bp_core_get_userlink( $user_id, false, true );775 776 /* Now write the values */777 $activity_id = xprofile_record_activity( array(778 'user_id' => $user_id,779 'content' => apply_filters( 'xprofile_activity_new_update_content', $activity_content ),780 'primary_link' => apply_filters( 'xprofile_activity_new_update_primary_link', $primary_link ),781 'component_action' => 'new_wire_post'782 ) );783 784 /* Add this update to the "latest update" usermeta so it can be fetched anywhere. */785 update_usermeta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );786 787 do_action( 'xprofile_posted_update', $content, $user_id, $activity_id );788 789 return $activity_id;790 }791 792 755 /*** Field Group Management **************************************************/ 793 756 -
trunk/bp-xprofile/bp-xprofile-notifications.php
r2218 r2287 1 1 <?php 2 3 function xprofile_at_message_notification( $content, $poster_user_id, $activity_id ) {4 global $bp;5 6 /* Scan for @username strings in an activity update. Notify each user. */7 $pattern = '/[@]+([A-Za-z0-9-_]+)/';8 preg_match_all( $pattern, $content, $usernames );9 10 /* Make sure there's only one instance of each username */11 if ( !$usernames = array_unique( $usernames[1] ) )12 return false;13 14 foreach( (array)$usernames as $username ) {15 if ( !$receiver_user_id = bp_core_get_userid($username) )16 continue;17 18 // Add a screen notification of an @message19 bp_core_add_notification( $activity_id, $receiver_user_id, $bp->profile->id, 'new_at_mention', $poster_user_id );20 21 // Now email the user with the contents of the message (if they have enabled email notifications)22 if ( !get_usermeta( $user_id, 'notification_activity_new_mention' ) || 'yes' == get_usermeta( $user_id, 'notification_activity_new_mention' ) ) {23 $poster_name = bp_core_get_user_displayname( $poster_user_id );24 25 $message_link = bp_activity_get_permalink( $activity_id );26 $settings_link = bp_core_get_user_domain( $user_id ) . 'settings/notifications/';27 28 // Set up and send the message29 $ud = get_userdata( $receiver_user_id );30 $to = $ud->user_email;31 $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), stripslashes($poster_name) );32 33 $message = sprintf( __(34 '%s mentioned you in an update:35 36 "%s"37 38 To view and respond to the message, log in and visit: %s39 40 ---------------------41 ', 'buddypress' ), $poster_name, wp_filter_kses( stripslashes($content) ), $message_link );42 43 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );44 45 // Send it46 wp_mail( $to, $subject, $message );47 }48 }49 }50 add_action( 'xprofile_posted_update', 'xprofile_at_message_notification', 10, 3 );51 2 52 3 /**
Note: See TracChangeset
for help on using the changeset viewer.