get_users will cause timeout
-
This code is causing a timeout after activating this plugin if the site has lots of users.
/funnel-builder/admin/db/wffn-updater-functions.php
if ( ! function_exists( 'wffn_update_email_default_settings' ) ) {
/**
* Function to set the default settings for notification settings
*
* @return void
*/
function wffn_update_email_default_settings() {
$new_settings = array(
'bwf_enable_notification' => true,
'bwf_notification_frequency' => array( 'weekly', 'monthly' ),
'bwf_notification_time' => array(
'hours' => '10',
'minutes' => '00',
'ampm' => 'am',
),
'bwf_external_user' => array(),
);
$users = get_users( array( 'role' => 'administrator' ) );
$user_selector = array();
foreach ( $users as $user ) {
$user_selector[] = array(
'id' => $user->ID,
'name' => $user->display_name . ' ( ' . $user->user_email . ' )',
);
}
$new_settings['bwf_notification_user_selector'] = $user_selector;
WFFN_Email_Notification::save_settings( $new_settings );
}
}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.