function cimy_switch_to_blog($meta = array()) { global $cimy_uef_plugins_dir; if (is_multisite() && $cimy_uef_plugins_dir == "plugins") { if (isset($meta["blog_id"])) { $mu_blog_id = intval($meta["blog_id"]); } else { if (isset($_GET["blog_id"])) { $mu_blog_id = intval($_GET["blog_id"]); } else { if (isset($_POST["blog_id"])) { $mu_blog_id = intval($_POST["blog_id"]); } else { $mu_blog_id = 1; } } } if (cimy_uef_mu_blog_exists($mu_blog_id)) { if (switch_to_blog($mu_blog_id)) { cimy_uef_set_tables(); } else { $mu_blog_id = 1; } } else { $mu_blog_id = 1; } } }
Unluckily WordPress MU is designed to disable ALL /plugins/* when activating a new user/blog, preventing Cimy User Extra Fields to correctly save extra fields data in that phase. If you installed Cimy User Extra Fields instead under /mu-plugins/ directory IGNORE this file! */ // need to know if registering with VHOST set to 'yes', as seems filters are not added in time, grr! if (constant("VHOST") == 'yes') { $cimy_uef_mu_register_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; } else { $cimy_uef_mu_register_action = ""; } if (isset($_REQUEST["blog_id"])) { $mu_blog_id = intval($_REQUEST["blog_id"]); if (cimy_uef_mu_blog_exists($mu_blog_id)) { switch_to_blog($mu_blog_id); } } if (!defined("WP_CONTENT_DIR")) { define("WP_CONTENT_DIR", ABSPATH . "/wp_content"); } // Leave this after all! if (defined('WP_INSTALLING') || $cimy_uef_mu_register_action == "register") { require_once WP_CONTENT_DIR . "/plugins/cimy-user-extra-fields/cimy_user_extra_fields.php"; } function cimy_uef_mu_blog_exists($blog_id, $c_site_id = -1) { global $wpdb, $site_id; $blog_id = intval($blog_id); $c_site_id = intval($c_site_id);
function cimy_switch_to_blog($meta = array()) { global $cimy_uef_plugins_dir; if (is_multisite() && $cimy_uef_plugins_dir == "plugins") { if (isset($meta["blog_id"])) { $mu_blog_id = intval($meta["blog_id"]); } else { if (isset($_GET["blog_id"])) { $mu_blog_id = intval($_GET["blog_id"]); } else { if (isset($_POST["blog_id"])) { $mu_blog_id = intval($_POST["blog_id"]); } } } // needed because WordPress 3.5+ MS doesn't like to redirect to wp-signup.php using 'blog_id' parameter if (isset($meta["from_blog_id"])) { $mu_blog_id = intval($meta["from_blog_id"]); } else { if (isset($_GET["from_blog_id"])) { $mu_blog_id = intval($_GET["from_blog_id"]); } else { if (isset($_POST["from_blog_id"])) { $mu_blog_id = intval($_POST["from_blog_id"]); } else { $mu_blog_id = 1; } } } if (cimy_uef_mu_blog_exists($mu_blog_id)) { if (!switch_to_blog($mu_blog_id)) { $mu_blog_id = 1; } } else { $mu_blog_id = 1; } } }