Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/12/2015 05:45:14 AM (11 years ago)
Author:
tw2113
Message:

Further documentation cleanup for Activity Component.

See #6396.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-notifications.php

    r10077 r10253  
    77 */
    88
    9 // Exit if accessed directly
     9// Exit if accessed directly.
    1010defined( 'ABSPATH' ) || exit;
    1111
     
    4141function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) {
    4242
    43         // Don't leave multiple notifications for the same activity item
     43        // Don't leave multiple notifications for the same activity item.
    4444        $notifications = BP_Core_Notification::get_all_for_user( $receiver_user_id, 'all' );
    4545
     
    5656        $content = '';
    5757
    58         // Now email the user with the contents of the message (if they have enabled email notifications)
     58        // Now email the user with the contents of the message (if they have enabled email notifications).
    5959        if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
    6060                $poster_name = bp_core_get_user_displayname( $activity->user_id );
     
    6767                $content = bp_activity_filter_kses( strip_tags( stripslashes( $activity->content ) ) );
    6868
    69                 // Set up and send the message
     69                // Set up and send the message.
    7070                $ud       = bp_core_get_core_userdata( $receiver_user_id );
    7171                $to       = $ud->user_email;
     
    9494                }
    9595
    96                 // Only show the disable notifications line if the settings component is enabled
     96                // Only show the disable notifications line if the settings component is enabled.
    9797                if ( bp_is_active( 'settings' ) ) {
    9898                        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     
    175175 * @param int   $comment_id   The comment id.
    176176 * @param int   $commenter_id The ID of the user who posted the comment.
    177  * @param array $params       {@link bp_activity_new_comment()}
    178  *
     177 * @param array $params       {@link bp_activity_new_comment()}.
    179178 * @return bool
    180179 */
    181180function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id = 0, $params = array() ) {
    182181
    183         // Set some default parameters
     182        // Set some default parameters.
    184183        $activity_id = 0;
    185184        $parent_id   = 0;
     
    198197                $content = bp_activity_filter_kses( stripslashes($content) );
    199198
    200                 // Set up and send the message
     199                // Set up and send the message.
    201200                $ud      = bp_core_get_core_userdata( $original_activity->user_id );
    202201                $to      = $ud->user_email;
     
    212211', 'buddypress' ), $poster_name, $content, $thread_link );
    213212
    214                 // Only show the disable notifications line if the settings component is enabled
     213                // Only show the disable notifications line if the settings component is enabled.
    215214                if ( bp_is_active( 'settings' ) ) {
    216215                        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     
    266265        }
    267266
    268         /***
     267        /*
    269268         * If this is a reply to another comment, send an email notification to the
    270269         * author of the immediate parent comment.
     
    282281                $settings_link = bp_core_get_user_domain( $parent_comment->user_id ) . $settings_slug . '/notifications/';
    283282
    284                 // Set up and send the message
     283                // Set up and send the message.
    285284                $ud       = bp_core_get_core_userdata( $parent_comment->user_id );
    286285                $to       = $ud->user_email;
     
    300299', 'buddypress' ), $poster_name, $content, $thread_link );
    301300
    302                 // Only show the disable notifications line if the settings component is enabled
     301                // Only show the disable notifications line if the settings component is enabled.
    303302                if ( bp_is_active( 'settings' ) ) {
    304303                        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     
    360359 * @since 1.9.0
    361360 *
    362  * @param int   $comment_id
    363  * @param array $params
     361 * @param int   $comment_id ID of the comment being notified about.
     362 * @param array $params     Parameters to use with notification.
    364363 */
    365364function bp_activity_new_comment_notification_helper( $comment_id, $params ) {
     
    387386 * @param int    $total_items       The total number of notifications to format.
    388387 * @param string $format            'string' to get a BuddyBar-compatible notification, 'array' otherwise.
    389  *
    390388 * @return string $return Formatted @mention notification.
    391389 */
     
    476474 * @since 1.9.0
    477475 *
    478  * @param object $activity
    479  * @param string $subject (not used)
    480  * @param string $message (not used)
    481  * @param string $content (not used)
    482  * @param int    $receiver_user_id
     476 * @param object $activity           Activity object.
     477 * @param string $subject (not used) Notification subject.
     478 * @param string $message (not used) Notification message.
     479 * @param string $content (not used) Notification content.
     480 * @param int    $receiver_user_id   ID of user receiving notification.
    483481 */
    484482function bp_activity_at_mention_add_notification( $activity, $subject, $message, $content, $receiver_user_id ) {
     
    509507        }
    510508
    511         // Only mark read if you're looking at your own mentions
     509        // Only mark read if you're looking at your own mentions.
    512510        if ( ! bp_is_my_profile() ) {
    513511                return;
     
    523521 * @since 2.0.0
    524522 *
    525  * @param object BP_Activity_Activity
     523 * @param BP_Activity_Activity $activity Activity object.
    526524 */
    527525function bp_activity_remove_screen_notifications_single_activity_permalink( $activity ) {
     
    534532        }
    535533
    536         // Mark as read any notifications for the current user related to this
    537         // activity item
     534        // Mark as read any notifications for the current user related to this activity item.
    538535        bp_notifications_mark_notifications_by_item_id( bp_loggedin_user_id(), $activity->id, buddypress()->activity->id, 'new_at_mention' );
    539536}
     
    549546function bp_activity_at_mention_delete_notification( $activity_ids_deleted = array() ) {
    550547        // Let's delete all without checking if content contains any mentions
    551         // to avoid a query to get the activity
     548        // to avoid a query to get the activity.
    552549        if ( bp_is_active( 'notifications' ) && ! empty( $activity_ids_deleted ) ) {
    553550                foreach ( $activity_ids_deleted as $activity_id ) {
Note: See TracChangeset for help on using the changeset viewer.