Skip to:
Content

BuddyPress.org

Changeset 10486


Ignore:
Timestamp:
01/31/2016 05:30:30 PM (9 years ago)
Author:
djpaul
Message:

Emails: make sure we are on root blog when redirecting to email customiser, or running the email repair tool.

See #6592

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/admin/bp-core-admin-tools.php

    r10476 r10486  
    428428 */
    429429function bp_admin_reinstall_emails() {
     430    $switched = false;
     431
     432    // Switch to the root blog, where the email posts live.
     433    if ( ! bp_is_root_blog() ) {
     434        switch_to_blog( bp_get_root_blog_id() );
     435        $switched = true;
     436    }
     437
    430438    $emails = get_posts( array(
    431439        'fields'           => 'ids',
     
    445453    bp_core_install_emails();
    446454
     455    if ( $switched ) {
     456        restore_current_blog();
     457    }
     458
    447459    return array( 0, __( 'Emails have been successfully reinstalled.', 'buddypress' ) );
    448460}
  • trunk/src/bp-core/bp-core-customizer-email.php

    r10475 r10486  
    393393 */
    394394function bp_email_redirect_to_customizer() {
     395    $switched = false;
     396
     397    // Switch to the root blog, where the email posts live.
     398    if ( ! bp_is_root_blog() ) {
     399        switch_to_blog( bp_get_root_blog_id() );
     400        $switched = true;
     401    }
     402
    395403    $email = get_posts( array(
    396404        'fields'           => 'ids',
     
    418426    );
    419427
     428    if ( $switched ) {
     429        restore_current_blog();
     430    }
     431
    420432    printf(
    421433        '<script type="text/javascript">window.location = "%s";</script>',
Note: See TracChangeset for help on using the changeset viewer.