function sb_we_loaded()
{
    add_action('init', 'sb_we_init');
    add_action('admin_menu', 'sb_we_admin_page');
    if ($settings = get_option('sb_we_settings')) {
        // prevent warning on $settings use when first enabled
    }
    add_filter('wpmu_welcome_user_notification', 'sb_we_mu_new_user_notification', 10, 3);
    global $sb_we_active;
    if (is_admin() && !empty($_REQUEST['_wp_http_referer'])) {
        if (!$sb_we_active) {
            $msg = '<div class="error"><p>' . SB_WE_PRODUCT_NAME . ' can not function because another plugin is conflicting. Please disable other plugins until this message disappears to fix the problem.</p></div>';
            add_action('admin_notices', create_function('', 'echo \'' . $msg . '\';'));
        }
        foreach ($_REQUEST as $key => $value) {
            if (substr($key, 0, 6) == 'sb_we_') {
                if (substr($key, 0, 13) == 'sb_we_resend_') {
                    if ($user_id = substr($key, 13)) {
                        sb_we_send_new_user_notification($user_id, true);
                        wp_redirect(admin_url('users.php'));
                    }
                }
            }
        }
    }
}
예제 #2
0
function sb_we_loaded()
{
    /* LS 10/11/2015 */
    global $sb_we_display_name;
    /* LS 10/11/2015 */
    add_action('init', 'sb_we_init');
    add_action('admin_menu', 'sb_we_admin_page');
    add_filter("retrieve_password_title", "sb_we_lost_password_title");
    add_filter("retrieve_password_message", "sb_we_lost_password_message", 10, 4);
    //delete_option('sb_we_settings');
    if (isset($_GET['hide_nag'])) {
        update_option('sb_we_hide_nag', time());
        header('location: ' . admin_url('options-general.php?page=sb_we_settings'));
        die;
    }
    if ($settings = get_option('sb_we_settings')) {
        // prevent warning on $settings use when first enabled
        if (version_compare(get_bloginfo('version'), '4.3') >= 0) {
            //only run when the version is on or past 4.3
            if (!get_option('sb_we_v4_migration_complete')) {
                //reset_pass_link replacement for legacy installs - remove around Christmas 2015.. maybe :)
                //This is to look in the settings for user_body, admin_body search and replace. plaintext_password and user_password
                $replace_to = '[reset_pass_link]';
                if ($settings->header_send_as == 'text') {
                    $replace_to = __('Visit [reset_pass] to set your password', SB_WE_DOMAIN);
                }
                $settings->user_body = str_replace('[plaintext_password]', $replace_to, $settings->user_body);
                $settings->user_body = str_replace('[user_password]', $replace_to, $settings->user_body);
                $settings->admin_body = str_replace('[plaintext_password]', $replace_to, $settings->admin_body);
                $settings->admin_body = str_replace('[user_password]', $replace_to, $settings->admin_body);
                update_option('sb_we_v4_migration_complete', time());
                //mark as having completed the migration
                update_option('sb_we_settings', $settings);
                //mark as having completed the migration
            }
        }
    }
    add_filter('wpmu_welcome_user_notification', 'sb_we_mu_new_user_notification', 10, 3);
    global $sb_we_active;
    if (is_admin() && !empty($_REQUEST['_wp_http_referer'])) {
        if (!$sb_we_active) {
            $msg = '<div class="error sbwe-error"><p>' . $sb_we_display_name . ' ' . __('can not function because another plugin is conflicting. Please disable other plugins until this message disappears to fix the problem.', SB_WE_DOMAIN) . '</p></div>';
            add_action('admin_notices', create_function('', 'echo \'' . $msg . '\';'));
        }
        foreach ($_REQUEST as $key => $value) {
            if (substr($key, 0, 6) == 'sb_we_') {
                if (substr($key, 0, 13) == 'sb_we_resend_') {
                    if ($user_id = substr($key, 13)) {
                        sb_we_send_new_user_notification($user_id, true, true);
                        wp_redirect(admin_url('users.php'));
                    }
                }
            }
        }
    }
}