Skip to:
Content

BuddyPress.org

Changeset 3633 for trunk/bp-activity.php


Ignore:
Timestamp:
12/31/2010 06:05:34 PM (14 years ago)
Author:
djpaul
Message:

Cleanup code in notification settings, and don't reinvent the wheel. Fixes #2987, props wpmuguru

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r3620 r3633  
    203203
    204204function bp_activity_screen_notification_settings() {
    205     global $bp;
    206    
    207     ?>
    208    
     205    global $bp;
     206
     207    $mention = get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true );
     208    if ( !$mention )
     209        $mention = 'yes';
     210
     211    $reply = get_user_meta( $bp->displayed_user->id, 'notification_activity_new_reply', true );
     212    if ( !$reply )
     213        $reply = 'yes';
     214?>
    209215    <table class="notification-settings zebra" id="activity-notification-settings">
    210216        <thead>
     
    221227                <td></td>
    222228                <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ?></td>
    223                 <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true ) || 'yes' == get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
    224                 <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
     229                <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td>
     230                <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td>
    225231            </tr>
    226232            <tr id="activity-notification-settings-replies">
    227233                <td></td>
    228234                <td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
    229                 <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) || 'yes' == get_user_meta( $bp->displayed_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
    230                 <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_user_meta( $bp->displayed_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
     235                <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php checked( $reply, 'yes', true ) ?>/></td>
     236                <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php checked( $reply, 'no', true ) ?>/></td>
    231237            </tr>
    232238
Note: See TracChangeset for help on using the changeset viewer.