Skip to:
Content

BuddyPress.org

Changeset 9216


Ignore:
Timestamp:
12/07/2014 12:27:30 AM (12 years ago)
Author:
tw2113
Message:

Add hook documentation for the Messages component.

Fixes #5945

Location:
trunk/src/bp-messages
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-classes.php

    r9185 r9216  
    269269                // No more recipients so delete all messages associated with the thread
    270270                if ( empty( $recipients ) ) {
     271
    271272                        /**
    272273                         * Fires before an entire message thread is deleted.
     
    732733                $this->date_sent = apply_filters( 'messages_message_date_sent_before_save', $this->date_sent, $this->id );
    733734
     735                /**
     736                 * Fires before the current message item gets saved.
     737                 *
     738                 * Please use this hook to filter the properties above. Each part will be passed in.
     739                 *
     740                 * @since BuddyPress (1.0.0)
     741                 *
     742                 * @param BP_Messages_Message Current instance of the message item being saved. Passed by reference.
     743                 */
    734744                do_action_ref_array( 'messages_message_before_save', array( &$this ) );
    735745
     
    771781                messages_remove_callback_values();
    772782
     783                /**
     784                 * Fires after the current message item has been saved.
     785                 *
     786                 * @since BuddyPress (1.0.0)
     787                 *
     788                 * @param BP_Messages_Message Current instance of the message item being saved. Passed by reference.
     789                 */
    773790                do_action_ref_array( 'messages_message_after_save', array( &$this ) );
    774791
     
    934951                $this->message = apply_filters( 'messages_notice_message_before_save', $this->message, $this->id );
    935952
     953                /**
     954                 * Fires before the current message notice item gets saved.
     955                 *
     956                 * Please use this hook to filter the properties above. Each part will be passed in.
     957                 *
     958                 * @since BuddyPress (1.0.0)
     959                 *
     960                 * @param BP_Messages_Notice Current instance of the message notice item being saved. Passed by reference.
     961                 */
    936962                do_action_ref_array( 'messages_notice_before_save', array( &$this ) );
    937963
     
    955981                bp_update_user_last_activity( bp_loggedin_user_id(), bp_core_current_time() );
    956982
     983                /**
     984                 * Fires after the current message notice item has been saved.
     985                 *
     986                 * @since BuddyPress (1.0.0)
     987                 *
     988                 * @param BP_Messages_Notice Current instance of the message item being saved. Passed by reference.
     989                 */
    957990                do_action_ref_array( 'messages_notice_after_save', array( &$this ) );
    958991
     
    9941027                global $wpdb, $bp;
    9951028
     1029                /**
     1030                 * Fires before the current message item has been deleted.
     1031                 *
     1032                 * @since BuddyPress (1.0.0)
     1033                 *
     1034                 * @param BP_Messages_Notice Current instance of the message notice item being deleted.
     1035                 */
    9961036                do_action( 'messages_notice_before_delete', $this );
    9971037
  • trunk/src/bp-messages/bp-messages-functions.php

    r9182 r9216  
    156156        }
    157157
    158         // Allow additional actions when a message is sent successfully
     158        /**
     159         * Fires after a message has been successfully sent.
     160         *
     161         * @since BuddyPress (1.1.0)
     162         *
     163         * @param BP_Messages_Message $message Message object. Passed by reference.
     164         */
    159165        do_action_ref_array( 'messages_message_sent', array( &$message ) );
    160166
     
    183189                $notice->save(); // send it.
    184190
     191                /**
     192                 * Fires after a notice has been successfully sent.
     193                 *
     194                 * @since BuddyPress (1.0.0)
     195                 *
     196                 * @param string $subject Subject of the notice.
     197                 * @param string $message Content of the notice.
     198                 */
    185199                do_action_ref_array( 'messages_send_notice', array( $subject, $message ) );
    186200
     
    196210 */
    197211function messages_delete_thread( $thread_ids ) {
     212
     213        /**
     214         * Fires before specified thread IDs have been deleted.
     215         *
     216         * @since BuddyPress (1.5.0)
     217         *
     218         * @param int|array Thread ID or array of thread IDs that were deleted.
     219         */
    198220        do_action( 'messages_before_delete_thread', $thread_ids );
    199221
     
    210232                }
    211233
     234                /**
     235                 * Fires after specified thread IDs have been deleted.
     236                 *
     237                 * @since BuddyPress (1.0.0)
     238                 *
     239                 * @param int|array Thread ID or array of thread IDs that were deleted.
     240                 */
    212241                do_action( 'messages_delete_thread', $thread_ids );
    213242
     
    218247                }
    219248
     249                /** This action is documented in bp-messages/bp-messages-functions.php */
    220250                do_action( 'messages_delete_thread', $thread_ids );
    221251
  • trunk/src/bp-messages/bp-messages-notifications.php

    r9208 r9216  
    9393                        }
    9494
    95                         // Send the message
     95                        /**
     96                         * Filters the user email that the message notification will be sent to.
     97                         *
     98                         * @since BuddyPress (1.2.0)
     99                         *
     100                         * @param string  $email_to User email the notification is being sent to.
     101                         * @param WP_User $ud       WP_User object of who is receiving the message.
     102                         */
    96103                        $email_to      = apply_filters( 'messages_notification_new_message_to',      $email_to, $ud );
     104
     105                        /**
     106                         * Filters the message notification subject that will be sent to user.
     107                         *
     108                         * @since BuddyPress (1.2.0)
     109                         *
     110                         * @param string  $email_subject Email notification subject text.
     111                         * @param string  $sender_name   Name of the person who sent the message.
     112                         * @param WP_User $ud            WP_User object of who is receiving the message.
     113                         */
    97114                        $email_subject = apply_filters( 'messages_notification_new_message_subject', $email_subject, $sender_name, $ud );
     115
     116                        /**
     117                         * Filters the message notification message that will be sent to user.
     118                         *
     119                         * @since BuddyPress (1.2.0)
     120                         *
     121                         * @param string  $email_content Email notification message text.
     122                         * @param string  $sender_name   Name of the person who sent the message.
     123                         * @param string  $subject       Email notification subject text.
     124                         * @param string  $content       Content of the message.
     125                         * @param string  $message_link  URL permalink for the message.
     126                         * @param string  $settings_link URL permalink for the user's notification settings area.
     127                         * @param WP_User $ud            WP_User object of who is receiving the message.
     128                         */
    98129                        $email_content = apply_filters( 'messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud );
    99130
     
    102133        }
    103134
     135        /**
     136         * Fires after the sending of a new message email notification.
     137         *
     138         * @since BuddyPress (1.5.0)
     139         *
     140         * @param array  $recipients    User IDs of recipients.
     141         * @param string $email_subject Email notification subject text.
     142         * @param string $email_content Email notification message text.
     143         * @param array  $$args         Array of originally provided arguments.
     144         */
    104145        do_action( 'bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args );
    105146}
     
    126167        $link        = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox' );
    127168        $title       = __( 'Inbox', 'buddypress' );
     169        $amount      = 'single';
    128170
    129171        if ( 'new_message' === $action ) {
     
    131173                        $amount = 'multiple';
    132174                        $text   = sprintf( __( 'You have %d new messages', 'buddypress' ), $total_items );
     175                        $amount = 'multiple';
    133176                } else {
    134177                        $amount = 'single';
     
    178221        }
    179222
     223        /**
     224         * Fires right before returning the formatted message notifications.
     225         *
     226         * @since BuddyPress (1.0.0)
     227         *
     228         * @param string $action            The type of message notification.
     229         * @param int    $item_id           The primary item ID.
     230         * @param int    $secondary_item_id The secondary item ID.
     231         * @param int    $total_items       Total amount of items to format.
     232         */
    180233        do_action( 'messages_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
    181234
  • trunk/src/bp-messages/bp-messages-screens.php

    r9190 r9216  
    2424        }
    2525
     26        /**
     27         * Fires right before the loading of the Messages inbox screen template file.
     28         *
     29         * @since BuddyPress (1.0.0)
     30         */
    2631        do_action( 'messages_screen_inbox' );
     32
     33        /**
     34         * Filters the template to load for the Messages inbox screen.
     35         *
     36         * @since BuddyPress (1.0.0)
     37         *
     38         * @param string $template Path to the messages template to load.
     39         */
    2740        bp_core_load_template( apply_filters( 'messages_template_inbox', 'members/single/home' ) );
    2841}
     
    3750        }
    3851
     52        /**
     53         * Fires right before the loading of the Messages sentbox screen template file.
     54         *
     55         * @since BuddyPress (1.0.0)
     56         */
    3957        do_action( 'messages_screen_sentbox' );
     58
     59        /**
     60         * Filters the template to load for the Messages sentbox screen.
     61         *
     62         * @since BuddyPress (1.0.0)
     63         *
     64         * @param string $template Path to the messages template to load.
     65         */
    4066        bp_core_load_template( apply_filters( 'messages_template_sentbox', 'members/single/home' ) );
    4167}
     
    77103                                $typed_recipients        = explode( ' ', $_POST['send_to_usernames'] );
    78104                                $recipients              = array_merge( (array) $autocomplete_recipients, (array) $typed_recipients );
     105
     106                                /**
     107                                 * Filters the array of recipients to receive the composed message.
     108                                 *
     109                                 * @since BuddyPress (1.2.10)
     110                                 *
     111                                 * @param array $recipients Array of recipients to receive message.
     112                                 */
    79113                                $recipients              = apply_filters( 'bp_messages_recipients', $recipients );
    80114                                $thread_id               = messages_new_message( array(
     
    95129        }
    96130
     131        /**
     132         * Fires right before the loading of the Messages compose screen template file.
     133         *
     134         * @since BuddyPress (1.0.0)
     135         */
    97136        do_action( 'messages_screen_compose' );
    98137
     138        /**
     139         * Filters the template to load for the Messages compose screen.
     140         *
     141         * @since BuddyPress (1.0.0)
     142         *
     143         * @param string $template Path to the messages template to load.
     144         */
    99145        bp_core_load_template( apply_filters( 'messages_template_compose', 'members/single/home' ) );
    100146}
     
    124170        $bp->bp_nav[$bp->messages->slug]['name'] = sprintf( __( 'Messages <span>%s</span>', 'buddypress' ), bp_get_total_unread_messages_count() );
    125171
     172        /**
     173         * Fires right before the loading of the Messages view screen template file.
     174         *
     175         * @since BuddyPress (1.7.0)
     176         */
    126177        do_action( 'messages_screen_conversation' );
    127178
     179        /**
     180         * Filters the template to load for the Messages view screen.
     181         *
     182         * @since BuddyPress (1.0.0)
     183         *
     184         * @param string $template Path to the messages template to load.
     185         */
    128186        bp_core_load_template( apply_filters( 'messages_template_view_message', 'members/single/home' ) );
    129187}
     
    174232        }
    175233
     234        /**
     235         * Fires right before the loading of the Messages notices screen template file.
     236         *
     237         * @since BuddyPress (1.0.0)
     238         */
    176239        do_action( 'messages_screen_notices' );
    177240
     241        /**
     242         * Filters the template to load for the Messages notices screen.
     243         *
     244         * @since BuddyPress (1.0.0)
     245         *
     246         * @param string $template Path to the messages template to load.
     247         */
    178248        bp_core_load_template( apply_filters( 'messages_template_notices', 'members/single/home' ) );
    179249}
     
    210280                        </tr>
    211281
    212                         <?php do_action( 'messages_screen_notification_settings' ) ?>
     282                        <?php
     283
     284                        /**
     285                         * Fires inside the closing </tbody> tag for messages screen notification settings.
     286                         *
     287                         * @since BuddyPress (1.0.0)
     288                         */
     289                        do_action( 'messages_screen_notification_settings' ); ?>
    213290                </tbody>
    214291        </table>
  • trunk/src/bp-messages/bp-messages-template.php

    r9195 r9216  
    252252                        return true;
    253253                } elseif ( $this->current_thread + 1 == $this->thread_count ) {
    254                         do_action('messages_box_loop_end');
     254
     255                        /**
     256                         * Fires when at the end of threads to iterate over.
     257                         *
     258                         * @since BuddyPress (1.5.0)
     259                         */
     260                        do_action( 'messages_box_loop_end' );
    255261                        // Do some cleaning up after the loop
    256262                        $this->rewind_threads();
     
    308314                // loop has just started
    309315                if ( 0 == $this->current_thread ) {
     316
     317                        /**
     318                         * Fires if at the start of the message thread loop.
     319                         *
     320                         * @since BuddyPress (1.5.0)
     321                         */
    310322                        do_action( 'messages_box_loop_start' );
    311323                }
     
    378390        );
    379391
     392        /**
     393         * Filters if there are any message threads to display in inbox/sentbox/notices.
     394         *
     395         * @since BuddyPress (1.1.0)
     396         *
     397         * @param bool                     $value             Whether or not the message has threads.
     398         * @param BP_Messages_Box_Template $messages_template Current message box template object.
     399         * @param array                    $r                 Array of parsed arguments passed into function.
     400         */
    380401        return apply_filters( 'bp_has_message_threads', $messages_template->has_threads(), $messages_template, $r );
    381402}
     
    415436                global $messages_template;
    416437
     438                /**
     439                 * Filters the ID of the current thread in the loop.
     440                 *
     441                 * @since BuddyPress (1.0.0)
     442                 *
     443                 * @param int $thread_id ID of the current thread in the loop.
     444                 */
    417445                return apply_filters( 'bp_get_message_thread_id', $messages_template->thread->thread_id );
    418446        }
     
    432460                global $messages_template;
    433461
     462                /**
     463                 * Filters the subject of the current thread in the loop.
     464                 *
     465                 * @since BuddyPress (1.1.0)
     466                 *
     467                 * @param string $value Subject of the current thread in the loop.
     468                 */
    434469                return apply_filters( 'bp_get_message_thread_subject', stripslashes_deep( $messages_template->thread->last_message_subject ) );
    435470        }
     
    449484                global $messages_template;
    450485
     486                /**
     487                 * Filters the excerpt of the current thread in the loop.
     488                 *
     489                 * @since BuddyPress (1.0.0)
     490                 *
     491                 * @param string $value Excerpt of the current thread in the loop.
     492                 */
    451493                return apply_filters( 'bp_get_message_thread_excerpt', strip_tags( bp_create_excerpt( $messages_template->thread->last_message_content, 75 ) ) );
    452494        }
     
    481523                global $messages_template;
    482524
     525                /**
     526                 * Filters the content of the last message in the thread.
     527                 *
     528                 * @since BuddyPress (2.0.0)
     529                 *
     530                 * @param string $last_message_content Content of the last message in the thread.
     531                 */
    483532                return apply_filters( 'bp_get_message_thread_content', $messages_template->thread->last_message_content );
    484533        }
     
    498547                global $messages_template;
    499548
     549                /**
     550                 * Filters the link to the page of the current thread's last author.
     551                 *
     552                 * @since BuddyPress (1.0.0)
     553                 *
     554                 * @param string $value Link to the page of the current thread's last author.
     555                 */
    500556                return apply_filters( 'bp_get_message_thread_from', bp_core_get_userlink( $messages_template->thread->last_sender_id ) );
    501557        }
     
    514570        function bp_get_message_thread_to() {
    515571                global $messages_template;
     572
     573                /**
     574                 * Filters the HTML links to the pages of the current thread's recipients.
     575                 *
     576                 * @since BuddyPress (1.0.0)
     577                 *
     578                 * @param string $value HTML links to the pages of the current thread's recipients.
     579                 */
    516580                return apply_filters( 'bp_message_thread_to', BP_Messages_Thread::get_recipient_links($messages_template->thread->recipients ) );
    517581        }
     
    542606                }
    543607
     608                /**
     609                 * Filters the permalink of a particular thread.
     610                 *
     611                 * @since BuddyPress (1.0.0)
     612                 *
     613                 * @param string $value permalink of a particular thread.
     614                 */
    544615                return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id ) );
    545616        }
     
    558629        function bp_get_message_thread_delete_link() {
    559630                global $messages_template;
     631
     632                /**
     633                 * Filters the URL for deleting the current thread.
     634                 *
     635                 * @since BuddyPress (1.0.0)
     636                 *
     637                 * @param string $value URL for deleting the current thread.
     638                 * @param string $value Text indicating action being executed.
     639                 */
    560640                return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/delete/' . $messages_template->thread->thread_id ), 'messages_delete_thread' ) );
    561641        }
     
    598678                $url = wp_nonce_url( $url, 'bp_message_thread_mark_unread_' . $id );
    599679
    600                 // Filter and return.
     680                /**
     681                 * Filters the URL used for marking a single message thread as unread.
     682                 *
     683                 * @since BuddyPress (2.2.0)
     684                 *
     685                 * @param string $url URL used for marking a single message thread as unread.
     686                 */
    601687                return apply_filters( 'bp_get_the_message_thread_mark_unread_url', $url );
    602688        }
     
    639725                $url = wp_nonce_url( $url, 'bp_message_thread_mark_read_' . $id );
    640726
    641                 // Filter and return.
     727                /**
     728                 * Filters the URL used for marking a single message thread as read.
     729                 *
     730                 * @since BuddyPress (2.2.0)
     731                 *
     732                 * @param string $url URL used for marking a single message thread as read.
     733                 */
    642734                return apply_filters( 'bp_get_the_message_thread_mark_read_url', $url );
    643735        }
     
    663755                }
    664756
     757                /**
     758                 * Filters the CSS class for the current thread.
     759                 *
     760                 * @since BuddyPress (1.2.10)
     761                 *
     762                 * @param string $class Class string to be added to the list of classes.
     763                 */
    665764                return apply_filters( 'bp_get_message_css_class', trim( $class ) );
    666765        }
     
    678777                : false;
    679778
     779        /**
     780         * Filters whether or not a message thread has unread items.
     781         *
     782         * @since BuddyPress (2.1.0)
     783         *
     784         * @param bool $retval Whether or not a message thread has unread items.
     785         */
    680786        return apply_filters( 'bp_message_thread_has_unread', $retval );
    681787}
     
    699805                        : false;
    700806
     807                /**
     808                 * Filters the current thread's unread count.
     809                 *
     810                 * @since BuddyPress (1.0.0)
     811                 *
     812                 * @param int $count Current thread unread count.
     813                 */
    701814                return apply_filters( 'bp_get_message_thread_unread_count', $count );
    702815        }
     
    735848                }
    736849
     850                /**
     851                 * Filters the current thread's total message count.
     852                 *
     853                 * @since BuddyPress (2.2.0)
     854                 *
     855                 * @param int $count Current thread total message count.
     856                 */
    737857                return apply_filters( 'bp_get_message_thread_total_count', $count );
    738858        }
     
    783903                global $messages_template;
    784904
     905                /**
     906                 * Filters the unformatted date of the last post in the current thread.
     907                 *
     908                 * @since BuddyPress (2.1.0)
     909                 *
     910                 * @param string $last_message_date Unformatted date of the last post in the current thread.
     911                 */
    785912                return apply_filters( 'bp_get_message_thread_last_message_date', $messages_template->thread->last_message_date );
    786913        }
     
    798925         */
    799926        function bp_get_message_thread_last_post_date() {
     927
     928                /**
     929                 * Filters the nicely formatted date of the last post in the current thread.
     930                 *
     931                 * @since BuddyPress (2.1.0)
     932                 *
     933                 * @param string $value Formatted date of the last post in the current thread.
     934                 */
    800935                return apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( strtotime( bp_get_message_thread_last_post_date_raw() ) ) );
    801936        }
     
    845980                ) );
    846981
     982                /**
     983                 * Filters the avatar for the last sender in the current message thread.
     984                 *
     985                 * @since BuddyPress (1.0.0)
     986                 *
     987                 * @param string $value User avatar string.
     988                 */
    847989                return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array(
    848990                        'item_id' => $messages_template->thread->last_sender_id,
     
    8681010         */
    8691011        function bp_get_total_unread_messages_count() {
     1012
     1013                /**
     1014                 * Filters the unread messages count for the current inbox.
     1015                 *
     1016                 * @since BuddyPress (1.0.0)
     1017                 *
     1018                 * @param int $value Unread messages count for the current inbox.
     1019                 */
    8701020                return apply_filters( 'bp_get_total_unread_messages_count', BP_Messages_Thread::get_inbox_count() );
    8711021        }
     
    8841034        function bp_get_messages_pagination() {
    8851035                global $messages_template;
     1036
     1037                /**
     1038                 * Filters the pagination HTML for the current thread loop.
     1039                 *
     1040                 * @since BuddyPress (1.0.0)
     1041                 *
     1042                 * @param int $pag_links Pagination HTML for the current thread loop.
     1043                 */
    8861044                return apply_filters( 'bp_get_messages_pagination', $messages_template->pag_links );
    8871045        }
     
    9331091         */
    9341092        function bp_get_messages_form_action() {
     1093
     1094                /**
     1095                 * Filters the form action for Messages HTML forms.
     1096                 *
     1097                 * @since BuddyPress (1.0.0)
     1098                 *
     1099                 * @param string The form action.
     1100                 */
    9351101                return apply_filters( 'bp_get_messages_form_action', trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' . bp_action_variable( 0 ) ) );
    9361102        }
     
    9491115        function bp_get_messages_username_value() {
    9501116                if ( isset( $_COOKIE['bp_messages_send_to'] ) ) {
     1117
     1118                        /**
     1119                         * Filters the default username for the recipient box.
     1120                         *
     1121                         * Value passed into filter is dependent on if the 'bp_messages_send_to'
     1122                         * cookie or 'r' $_GET parameter is set.
     1123                         *
     1124                         * @since BuddyPress (1.0.0)
     1125                         *
     1126                         * @param string $value Default user name.
     1127                         */
    9511128                        return apply_filters( 'bp_get_messages_username_value', $_COOKIE['bp_messages_send_to'] );
    9521129                } else if ( isset( $_GET['r'] ) && !isset( $_COOKIE['bp_messages_send_to'] ) ) {
     1130                        /** This filter is documented in bp-messages-template.php */
    9531131                        return apply_filters( 'bp_get_messages_username_value', $_GET['r'] );
    9541132                }
     
    9741152                        : '';
    9751153
     1154                /**
     1155                 * Filters the default value for the subject field.
     1156                 *
     1157                 * @since BuddyPress (1.0.0)
     1158                 *
     1159                 * @param string $subject The default value for the subject field.
     1160                 */
    9761161                return apply_filters( 'bp_get_messages_subject_value', $subject );
    9771162        }
     
    9971182                        : '';
    9981183
     1184                /**
     1185                 * Filters the default value for the content field.
     1186                 *
     1187                 * @since BuddyPress (1.0.0)
     1188                 *
     1189                 * @param string $content The default value for the content field.
     1190                 */
    9991191                return apply_filters( 'bp_get_messages_content_value', $content );
    10001192        }
     
    10591251                : false;
    10601252
     1253        /**
     1254         * Filters whether or not the notice is currently active.
     1255         *
     1256         * @since BuddyPress (2.1.0)
     1257         *
     1258         * @param bool $retval Whether or not the notice is currently active.
     1259         */
    10611260        return apply_filters( 'bp_messages_is_active_notice', $retval );
    10621261}
     
    11061305        function bp_get_message_notice_id() {
    11071306                global $messages_template;
     1307
     1308                /**
     1309                 * Filters the ID of the current notice in the loop.
     1310                 *
     1311                 * @since BuddyPress (1.5.0)
     1312                 *
     1313                 * @param int $id ID of the current notice in the loop.
     1314                 */
    11081315                return apply_filters( 'bp_get_message_notice_id', $messages_template->thread->id );
    11091316        }
     
    11221329        function bp_get_message_notice_post_date() {
    11231330                global $messages_template;
     1331
     1332                /**
     1333                 * Filters the post date of the current notice in the loop.
     1334                 *
     1335                 * @since BuddyPress (1.0.0)
     1336                 *
     1337                 * @param string $value Formatted post date of the current notice in the loop.
     1338                 */
    11241339                return apply_filters( 'bp_get_message_notice_post_date', bp_format_time( strtotime( $messages_template->thread->date_sent ) ) );
    11251340        }
     
    11381353        function bp_get_message_notice_subject() {
    11391354                global $messages_template;
     1355
     1356                /**
     1357                 * Filters the subject of the current notice in the loop.
     1358                 *
     1359                 * @since BuddyPress (1.0.0)
     1360                 *
     1361                 * @param string $subject Subject of the current notice in the loop.
     1362                 */
    11401363                return apply_filters( 'bp_get_message_notice_subject', $messages_template->thread->subject );
    11411364        }
     
    11541377        function bp_get_message_notice_text() {
    11551378                global $messages_template;
     1379
     1380                /**
     1381                 * Filters the text of the current notice in the loop.
     1382                 *
     1383                 * @since BuddyPress (1.0.0)
     1384                 *
     1385                 * @param string $message Text for the current notice in the loop.
     1386                 */
    11561387                return apply_filters( 'bp_get_message_notice_text', $messages_template->thread->message );
    11571388        }
     
    11711402                global $messages_template;
    11721403
     1404                /**
     1405                 * Filters the URL for deleting the current notice.
     1406                 *
     1407                 * @since BuddyPress (1.0.0)
     1408                 *
     1409                 * @param string $value URL for deleting the current notice.
     1410                 * @param string $value Text indicating action being executed.
     1411                 */
    11731412                return apply_filters( 'bp_get_message_notice_delete_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/delete/' . $messages_template->thread->id, 'messages_delete_thread' ) );
    11741413        }
     
    11931432                        $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/activate/' . $messages_template->thread->id ), 'messages_activate_notice' );
    11941433                }
     1434
     1435                /**
     1436                 * Filters the URL for deactivating the current notice.
     1437                 *
     1438                 * @since BuddyPress (1.0.0)
     1439                 *
     1440                 * @param string $link URL for deactivating the current notice.
     1441                 */
    11951442                return apply_filters( 'bp_get_message_activate_deactivate_link', $link );
    11961443        }
     
    12031450}
    12041451        /**
    1205          * Generate the text ('Deactivate' or 'Activate' for the notice action link.
     1452         * Generate the text ('Deactivate' or 'Activate') for the notice action link.
    12061453         *
    12071454         * @return string
     
    12151462                        $text = __('Activate', 'buddypress');
    12161463                }
     1464
     1465                /**
     1466                 * Filters the "Deactivate" or "Activate" text for notice action links.
     1467                 *
     1468                 * @since BuddyPress (1.0.0)
     1469                 *
     1470                 * @param string $text Text used for notice action links.
     1471                 */
    12171472                return apply_filters( 'bp_message_activate_deactivate_text', $text );
    12181473        }
     
    12361491         */
    12371492        function bp_get_messages_slug() {
     1493
     1494                /**
     1495                 * Filters the messages component slug.
     1496                 *
     1497                 * @since BuddyPress (1.5.0)
     1498                 *
     1499                 * @param string $slug Messages component slug.
     1500                 */
    12381501                return apply_filters( 'bp_get_messages_slug', buddypress()->messages->slug );
    12391502        }
     
    12871550                }
    12881551
     1552                /**
     1553                 * Filters the URL for the Private Message link in member profile headers.
     1554                 *
     1555                 * @since BuddyPress (1.2.10)
     1556                 *
     1557                 * @param string $value URL for the Private Message link in member profile headers.
     1558                 */
    12891559                return apply_filters( 'bp_get_send_private_message_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( bp_displayed_user_id() ) ) );
    12901560        }
     
    13181588                // 'bp_get_send_message_button_args' instead. See #4536
    13191589                return apply_filters( 'bp_get_send_message_button',
     1590                        /**
     1591                         * Filters the "Private Message" button for member profile headers.
     1592                         *
     1593                         * @since BuddyPress (1.8.0)
     1594                         *
     1595                         * @param array $value See {@link BP_Button}.
     1596                         */
    13201597                        bp_get_button( apply_filters( 'bp_get_send_message_button_args', array(
    13211598                                'id'                => 'private_message',
     
    13441621         */
    13451622        function bp_get_message_loading_image_src() {
     1623
     1624                /**
     1625                 * Filters the URL of the Messages AJAX loader gif.
     1626                 *
     1627                 * @since BuddyPress (1.0.0)
     1628                 *
     1629                 * @param string $value URL of the Messages AJAX loader gif.
     1630                 */
    13461631                return apply_filters( 'bp_get_message_loading_image_src', buddypress()->messages->image_base . '/ajax-loader.gif' );
    13471632        }
     
    13861671                $recipients = isset( $_GET['r'] ) ? stripslashes( $_GET['r'] ) : '';
    13871672
     1673                /**
     1674                 * Filters the recipients usernames for prefilling the 'To' field on the Compose screen.
     1675                 *
     1676                 * @since BuddyPress (1.0.0)
     1677                 *
     1678                 * @param string $recipients Recipients usernames for 'To' field prefilling.
     1679                 */
    13881680                return apply_filters( 'bp_get_message_get_recipient_usernames', $recipients );
    13891681        }
     
    15361828                        return true;
    15371829                } elseif ( ( $this->current_message + 1 ) === $this->message_count ) {
     1830
     1831                        /**
     1832                         * Fires when at the end of messages to iterate over.
     1833                         *
     1834                         * @since BuddyPress (1.1.0)
     1835                         */
    15381836                        do_action( 'thread_loop_end' );
    15391837                        // Do some cleaning up after the loop
     
    15601858                // loop has just started
    15611859                if ( 0 === $this->current_message ) {
     1860
     1861                        /**
     1862                         * Fires if at the start of the message loop.
     1863                         *
     1864                         * @since BuddyPress (1.1.0)
     1865                         */
    15621866                        do_action( 'thread_loop_start' );
    15631867                }
     
    16531957                global $thread_template;
    16541958
     1959                /**
     1960                 * Filters the ID of the thread that the current loop belongs to.
     1961                 *
     1962                 * @since BuddyPress (1.1.0)
     1963                 *
     1964                 * @param int $thread_id ID of the thread.
     1965                 */
    16551966                return apply_filters( 'bp_get_the_thread_id', $thread_template->thread->thread_id );
    16561967        }
     
    16701981                global $thread_template;
    16711982
     1983                /**
     1984                 * Filters the subject of the thread currently being iterated over.
     1985                 *
     1986                 * @since BuddyPress (1.1.0)
     1987                 *
     1988                 * @return string $last_message_subject Subject of the thread currently being iterated over.
     1989                 */
    16721990                return apply_filters( 'bp_get_the_thread_subject', $thread_template->thread->last_message_subject );
    16731991        }
     
    17362054                }
    17372055
     2056                /**
     2057                 * Filters the HTML links to the profiles of recipients in the current thread.
     2058                 *
     2059                 * @since BuddyPress (2.2.0)
     2060                 *
     2061                 * @param string $value Comma-separated list of recipient HTML links for current thread.
     2062                 */
    17382063                return apply_filters( 'bp_get_the_thread_recipients_list', implode( ', ', $recipient_links ) );
    17392064        }
     
    17612086                        : null;
    17622087
     2088                /**
     2089                 * Filters the ID of the current message in the thread.
     2090                 *
     2091                 * @since BuddyPress (1.9.0)
     2092                 *
     2093                 * @param int $thread_message_id ID of the current message in the thread.
     2094                 */
    17632095                return apply_filters( 'bp_get_the_thread_message_id', $thread_message_id );
    17642096        }
     
    17952127                }
    17962128
     2129                /**
     2130                 * Filters the CSS classes for messages within a single thread.
     2131                 *
     2132                 * @since BuddyPress (2.1.0)
     2133                 *
     2134                 * @param array $classes Array of classes to add to the HTML class attribute.
     2135                 */
    17972136                $classes = apply_filters( 'bp_get_the_thread_message_css_class', $classes );
    17982137
     
    18202159                }
    18212160
     2161                /**
     2162                 * Filters the CSS class used for message zebra striping.
     2163                 *
     2164                 * @since BuddyPress (1.1.0)
     2165                 *
     2166                 * @param string $class Class determined to be next for zebra striping effect.
     2167                 */
    18222168                return apply_filters( 'bp_get_the_thread_message_alt_class', $class );
    18232169        }
     
    18452191                        : 0;
    18462192
     2193                /**
     2194                 * Filters the ID for message sender within a single thread.
     2195                 *
     2196                 * @since BuddyPress (2.1.0)
     2197                 *
     2198                 * @param int $user_id ID of the message sender.
     2199                 */
    18472200                return (int) apply_filters( 'bp_get_the_thread_message_css_class', (int) $user_id );
    18482201        }
     
    18782231                ) );
    18792232
     2233                /**
     2234                 * Filters the avatar for the current message sender.
     2235                 *
     2236                 * @since BuddyPress (1.1.0)
     2237                 *
     2238                 * @param string $value <img> tag containing the avatar value.
     2239                 */
    18802240                return apply_filters( 'bp_get_the_thread_message_sender_avatar_thumb', bp_core_fetch_avatar( array(
    18812241                        'item_id' => $thread_template->message->sender_id,
     
    19012261                global $thread_template;
    19022262
     2263                /**
     2264                 * Filters the link to the sender of the current message.
     2265                 *
     2266                 * @since BuddyPress (1.1.0)
     2267                 *
     2268                 * @param string $value Link to the sender of the current message.
     2269                 */
    19032270                return apply_filters( 'bp_get_the_thread_message_sender_link', bp_core_get_userlink( $thread_template->message->sender_id, false, true ) );
    19042271        }
     
    19242291                }
    19252292
     2293                /**
     2294                 * Filters the display name of the sender of the current message.
     2295                 *
     2296                 * @since BuddyPress (1.1.0)
     2297                 *
     2298                 * @param string $display_name Display name of the sender of the current message.
     2299                 */
    19262300                return apply_filters( 'bp_get_the_thread_message_sender_name', $display_name );
    19272301        }
     
    19392313         */
    19402314        function bp_get_the_thread_delete_link() {
     2315
     2316                /**
     2317                 * Filters the URL for deleting the current thread.
     2318                 *
     2319                 * @since BuddyPress (1.0.0)
     2320                 *
     2321                 * @param string $value URL for deleting the current thread.
     2322                 * @param string $value Text indicating action being executed.
     2323                 */
    19412324                return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox/delete/' . bp_get_the_thread_id(), 'messages_delete_thread' ) );
    19422325        }
     
    19542337         */
    19552338        function bp_get_the_thread_message_time_since() {
     2339
     2340                /**
     2341                 * Filters the 'Sent x hours ago' string for the current message.
     2342                 *
     2343                 * @since BuddyPress (1.1.0)
     2344                 *
     2345                 * @param string $value Default text of 'Sent x hours ago'.
     2346                 */
    19562347                return apply_filters( 'bp_get_the_thread_message_time_since', sprintf( __( 'Sent %s', 'buddypress' ), bp_core_time_since( bp_get_the_thread_message_date_sent() ) ) );
    19572348        }
     
    19762367                global $thread_template;
    19772368
     2369                /**
     2370                 * Filters the date sent value for the current message as a timestamp.
     2371                 *
     2372                 * @since BuddyPress (2.1.0)
     2373                 *
     2374                 * @param string $value Timestamp of the date sent value for the current message.
     2375                 */
    19782376                return apply_filters( 'bp_get_the_thread_message_date_sent', strtotime( $thread_template->message->date_sent ) );
    19792377        }
     
    19932391                global $thread_template;
    19942392
     2393                /**
     2394                 * Filters the content of the current message in the loop.
     2395                 *
     2396                 * @since BuddyPress (1.1.0)
     2397                 *
     2398                 * @param string $message The content of the current message in the loop.
     2399                 */
    19952400                return apply_filters( 'bp_get_the_thread_message_content', $thread_template->message->message );
    19962401        }
  • trunk/src/bp-messages/bp-messages-widgets.php

    r9207 r9216  
    6565
    6666                /**
    67                  * Filters the title of the Friends widget.
     67                 * Filters the title of the Messages widget.
    6868                 *
    6969                 * @since BuddyPress (1.9.0)
Note: See TracChangeset for help on using the changeset viewer.