bp_email_get_redirect_to_customizer_url()
Return a redirect url to the Customizer, previewing a randomly selected email.
Description
Source
File: bp-core/bp-core-customizer-email.php
function bp_email_get_redirect_to_customizer_url() { $switched = false; // Switch to the root blog, where the email posts live. if ( ! bp_is_root_blog() ) { switch_to_blog( bp_get_root_blog_id() ); $switched = true; } $email = get_posts( array( 'fields' => 'ids', // 'orderby' => 'rand', 'post_status' => 'publish', 'post_type' => bp_get_email_post_type(), 'posts_per_page' => 1, 'suppress_filters' => false, ) ); $preview_url = admin_url(); if ( $email ) { $preview_url = get_post_permalink( $email[0] ) . '&bp_customizer=email'; } $redirect_url = add_query_arg( array( 'autofocus[panel]' => 'bp_mailtpl', 'bp_customizer' => 'email', 'return' => rawurlencode( add_query_arg( array( 'post_type' => bp_get_email_post_type(), ), admin_url( 'edit.php' ) ) ), 'url' => rawurlencode( $preview_url ), ), admin_url( 'customize.php' ) ); if ( $switched ) { restore_current_blog(); } return $redirect_url; }
Changelog
Version | Description |
---|---|
BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.