Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
do some function exists checks for active bp components. These do not…
Browse files Browse the repository at this point in the history
… necessarily "ruin" all of our functionality, and are just garnishes of information, so it is safe to potentially not run
  • Loading branch information
tw2113 committed Oct 4, 2019
1 parent a312629 commit 5401f88
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions includes/core.php
Expand Up @@ -125,16 +125,18 @@ function bp_registration_options_bp_core_register_account( $user_id ) {

bp_registration_options_delete_user_count_transient();

// Set admin notification for new member.
$enable_notifications = (bool) get_option( 'bprwg_enable_notifications' );
if ( bp_is_active( 'notifications' ) && $enable_notifications ) {
foreach ( $admins as $admin ) {
bp_notifications_add_notification( array(
'user_id' => $admin->ID,
'component_name' => 'bp_registration_options',
'component_action' => 'bp_registration_options',
'allow_duplicate' => true,
) );
if ( function_exists( 'bp_is_active' ) ) {
// Set admin notification for new member.
$enable_notifications = (bool) get_option( 'bprwg_enable_notifications' );
if ( bp_is_active( 'notifications' ) && $enable_notifications ) {
foreach ( $admins as $admin ) {
bp_notifications_add_notification( array(
'user_id' => $admin->ID,
'component_name' => 'bp_registration_options',
'component_action' => 'bp_registration_options',
'allow_duplicate' => true,
) );
}
}
}
}
Expand Down Expand Up @@ -248,7 +250,7 @@ function bp_registration_hide_ui() {
if ( ! empty( $_POST['object'] ) ) {
$object = sanitize_title( $_POST['object'] );

if ( bp_is_active( $object ) ) {
if ( function_exists( 'bp_is_active' ) && bp_is_active( $object ) ) {
add_filter( 'wp_ajax_' . $object . '_filter', 'bp_registration_hide_ui', 1 );
}
} else {
Expand Down Expand Up @@ -747,6 +749,10 @@ function bp_registration_options_prevent_activity_posting( $args ) {
* @param int $user_id ID of the approved user.
*/
function bp_registration_options_display_activity_posting( $user_id ) {
if ( ! function_exists( 'bp_is_active' ) ) {
return;
}

if ( bp_is_active( 'activity' ) ) {
bp_activity_add( array(
'user_id' => $user_id,
Expand Down

0 comments on commit 5401f88

Please sign in to comment.