Skip to:
Content

BuddyPress.org

Changeset 5773


Ignore:
Timestamp:
02/13/2012 03:44:13 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Tweak bp_message_is_active_notice() usage. Introduce bp_messages_is_active_notice() to maintain backpat. Fixes #3970. Props hnla, paulgibbs.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-template.php

    r5758 r5773  
    123123
    124124    function the_message_thread() {
    125         global $bp;
    126125
    127126        $this->in_the_loop = true;
    128         $this->thread = $this->next_thread();
     127        $this->thread      = $this->next_thread();
    129128
    130129        if ( ! bp_is_current_action( 'notices' ) ) {
    131             $last_message_index = count( $this->thread->messages ) - 1;
     130            $last_message_index     = count( $this->thread->messages ) - 1;
    132131            $this->thread->messages = array_reverse( (array) $this->thread->messages );
    133132
     
    152151            }
    153152
    154             $this->thread->last_message_id = $this->thread->messages[$last_message_index]->id;
    155             $this->thread->last_message_date = $this->thread->messages[$last_message_index]->date_sent;
    156             $this->thread->last_sender_id = $this->thread->messages[$last_message_index]->sender_id;
     153            $this->thread->last_message_id      = $this->thread->messages[$last_message_index]->id;
     154            $this->thread->last_message_date    = $this->thread->messages[$last_message_index]->date_sent;
     155            $this->thread->last_sender_id       = $this->thread->messages[$last_message_index]->sender_id;
    157156            $this->thread->last_message_subject = $this->thread->messages[$last_message_index]->subject;
    158157            $this->thread->last_message_content = $this->thread->messages[$last_message_index]->message;
    159158        }
    160159
    161         if ( 0 == $this->current_thread ) // loop has just started
     160        // loop has just started
     161        if ( 0 == $this->current_thread ) {
    162162            do_action('messages_box_loop_start');
     163        }
    163164    }
    164165}
     
    185186        }
    186187
    187         if ( bp_is_current_action( 'sentbox' ) )
     188        if ( bp_is_current_action( 'sentbox' ) ) {
    188189            $box = 'sentbox';
    189 
    190         if ( bp_is_current_action( 'notices' ) )
     190        }
     191
     192        if ( bp_is_current_action( 'notices' ) ) {
    191193            $box = 'notices';
     194        }
    192195
    193196        $messages_template = new BP_Messages_Box_Template( $user_id, $box, $per_page, $max, $type );
     
    406409
    407410function bp_messages_options() {
    408     global $bp; ?>
     411?>
    409412
    410413    <?php _e( 'Select:', 'buddypress' ) ?>
     
    429432}
    430433
     434/**
     435 * Return whether or not the notice is currently active
     436 *
     437 * @since BuddyPress (1.6)
     438 * @uses bp_get_messages_is_active_notice()
     439 */
     440function bp_messages_is_active_notice() {
     441    global $messages_template;
     442
     443    if ( $messages_template->thread->is_active )
     444        return true;
     445
     446    return false;
     447}
     448
     449/**
     450 * Output a string for the active notice
     451 *
     452 * Since 1.6 this function has been deprecated in favor of text in the theme
     453 *
     454 * @since BuddyPress (1.0)
     455 * @deprecated BuddyPress (1.6)
     456 * @uses bp_get_message_is_active_notice()
     457 */
    431458function bp_message_is_active_notice() {
    432     global $messages_template;
    433 
    434     if ( $messages_template->thread->is_active ) {
    435         echo "<strong>";
    436         _e( 'Currently Active', 'buddypress' );
    437         echo "</strong>";
    438     }
    439 }
     459    echo bp_get_message_is_active_notice();
     460}
     461    /**
     462     * Returns a string for the active notice
     463     *
     464     * Since 1.6 this function has been deprecated in favor of text in the theme
     465     *
     466     * @since BuddyPress (1.0)
     467     * @deprecated BuddyPress (1.6)
     468     * @uses bp_messages_is_active_notice()
     469     */
    440470    function bp_get_message_is_active_notice() {
    441         global $messages_template;
    442 
    443         if ( $messages_template->thread->is_active )
    444             return true;
    445 
    446         return false;
     471
     472        $string = '';
     473        if ( bp_messages_is_active_notice() )
     474            $string = __( 'Currently Active', 'buddypress' );
     475
     476        return apply_filters( 'bp_get_message_is_active_notice', $string );
    447477    }
    448478
  • trunk/bp-themes/bp-default/members/single/messages/notices-loop.php

    r5737 r5773  
    2121        <?php while ( bp_message_threads() ) : bp_message_thread(); ?>
    2222            <tr id="notice-<?php bp_message_notice_id(); ?>" class="<?php bp_message_css_class(); ?>">
    23                 <td width="1%">
    24                 </td>
     23                <td width="1%"></td>
    2524                <td width="38%">
    2625                    <strong><?php bp_message_notice_subject(); ?></strong>
     
    2827                </td>
    2928                <td width="21%">
    30                     <strong><?php bp_message_is_active_notice(); ?></strong>
    31                     <span class="activity"><?php _e("Sent:", "buddypress"); ?> <?php bp_message_notice_post_date(); ?></span>
     29
     30                    <?php if ( bp_messages_is_active_notice() ) : ?>
     31
     32                        <strong><?php bp_messages_is_active_notice(); ?></strong>
     33
     34                    <?php endif; ?>
     35
     36                    <span class="activity"><?php _e( 'Sent:', 'buddypress' ); ?> <?php bp_message_notice_post_date(); ?></span>
    3237                </td>
    3338
Note: See TracChangeset for help on using the changeset viewer.