Skip to:
Content

BuddyPress.org

Changeset 3633 for trunk/bp-groups.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-groups.php

    r3627 r3633  
    948948
    949949function groups_screen_notification_settings() {
    950     global $bp;
    951    
    952     ?>
    953    
     950    global $bp;
     951
     952    $group_invite = get_user_meta( $bp->displayed_user->id, 'notification_groups_invite', true );
     953    if ( !$group_invite )
     954        $group_invite = 'yes';
     955
     956    $group_update = get_user_meta( $bp->displayed_user->id, 'notification_groups_group_updated', true );
     957    if ( !$group_update )
     958        $group_update = 'yes';
     959
     960    $group_promo = get_user_meta( $bp->displayed_user->id, 'notification_groups_admin_promotion', true );
     961    if ( !$group_promo )
     962        $group_promo = 'yes';
     963
     964    $group_request = get_user_meta( $bp->displayed_user->id, 'notification_groups_membership_request', true );
     965    if ( !$group_request )
     966        $group_request = 'yes';
     967?>
    954968    <table class="notification-settings zebra" id="groups-notification-settings">
    955969        <thead>
     
    966980                <td></td>
    967981                <td><?php _e( 'A member invites you to join a group', 'buddypress' ) ?></td>
    968                 <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php if ( !get_user_meta( $bp->displayed_user->id, 'notification_groups_invite', true ) || 'yes' == get_user_meta( $bp->displayed_user->id, 'notification_groups_invite', true ) ) { ?>checked="checked" <?php } ?>/></td>
    969                 <td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php if ( 'no' == get_user_meta( $bp->displayed_user->id, 'notification_groups_invite', true ) ) { ?>checked="checked" <?php } ?>/></td>
     982                <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php checked( $group_invite, 'yes', true ) ?>/></td>
     983                <td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php checked( $group_invite, 'no', true ) ?>/></td>
    970984            </tr>
    971985            <tr id="groups-notification-settings-info-updated">
    972986                <td></td>
    973987                <td><?php _e( 'Group information is updated', 'buddypress' ) ?></td>
    974                 <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php if ( !get_user_meta( $bp->displayed_user->id, 'notification_groups_group_updated', true ) || 'yes' == get_user_meta( $bp->displayed_user->id, 'notification_groups_group_updated', true ) ) { ?>checked="checked" <?php } ?>/></td>
    975                 <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php if ( 'no' == get_user_meta( $bp->displayed_user->id, 'notification_groups_group_updated', true ) ) { ?>checked="checked" <?php } ?>/></td>
     988                <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php checked( $group_update, 'yes', true ) ?>/></td>
     989                <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php checked( $group_update, 'no', true ) ?>/></td>
    976990            </tr>
    977991            <tr id="groups-notification-settings-promoted">
    978992                <td></td>
    979993                <td><?php _e( 'You are promoted to a group administrator or moderator', 'buddypress' ) ?></td>
    980                 <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php if ( !get_user_meta( $bp->displayed_user->id, 'notification_groups_admin_promotion', true ) || 'yes' == get_user_meta( $bp->displayed_user->id, 'notification_groups_admin_promotion', true ) ) { ?>checked="checked" <?php } ?>/></td>
    981                 <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php if ( 'no' == get_user_meta( $bp->displayed_user->id, 'notification_groups_admin_promotion', true ) ) { ?>checked="checked" <?php } ?>/></td>
     994                <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php checked( $group_promo, 'yes', true ) ?>/></td>
     995                <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php checked( $group_promo, 'no', true ) ?>/></td>
    982996            </tr>
    983997            <tr id="groups-notification-settings-request">
    984998                <td></td>
    985999                <td><?php _e( 'A member requests to join a private group for which you are an admin', 'buddypress' ) ?></td>
    986                 <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php if ( !get_user_meta( $bp->displayed_user->id, 'notification_groups_membership_request', true ) || 'yes' == get_user_meta( $bp->displayed_user->id, 'notification_groups_membership_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
    987                 <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php if ( 'no' == get_user_meta( $bp->displayed_user->id, 'notification_groups_membership_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
     1000                <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php checked( $group_request, 'yes', true ) ?>/></td>
     1001                <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php checked( $group_request, 'no', true ) ?>/></td>
    9881002            </tr>
    9891003
Note: See TracChangeset for help on using the changeset viewer.