• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpmu_welcome_user_notification函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wpmu_welcome_user_notification函数的典型用法代码示例。如果您正苦于以下问题:PHP wpmu_welcome_user_notification函数的具体用法?PHP wpmu_welcome_user_notification怎么用?PHP wpmu_welcome_user_notification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wpmu_welcome_user_notification函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wpmu_activate_signup

/**
 * Activate a signup.
 *
 * Hook to 'wpmu_activate_user' or 'wpmu_activate_blog' for events
 * that should happen only when users or sites are self-created (since
 * those actions are not called when users and sites are created
 * by a Super Admin).
 *
 * @since MU
 * @uses wp_generate_password()
 * @uses wpmu_welcome_user_notification()
 * @uses add_user_to_blog()
 * @uses add_new_user_to_blog()
 * @uses wpmu_create_user()
 * @uses wpmu_create_blog()
 * @uses wpmu_welcome_notification()
 *
 * @param string $key The activation key provided to the user.
 * @return array An array containing information about the activated user and/or blog
 */
function wpmu_activate_signup($key)
{
    global $wpdb, $current_site;
    $signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->signups} WHERE activation_key = %s", $key));
    if (empty($signup)) {
        return new WP_Error('invalid_key', __('Invalid activation key.'));
    }
    if ($signup->active) {
        if (empty($signup->domain)) {
            return new WP_Error('already_active', __('The user is already active.'), $signup);
        } else {
            return new WP_Error('already_active', __('The site is already active.'), $signup);
        }
    }
    $meta = unserialize($signup->meta);
    $user_login = $wpdb->escape($signup->user_login);
    $user_email = $wpdb->escape($signup->user_email);
    $password = wp_generate_password(12, false);
    $user_id = username_exists($user_login);
    if (!$user_id) {
        $user_id = wpmu_create_user($user_login, $password, $user_email);
    } else {
        $user_already_exists = true;
    }
    if (!$user_id) {
        return new WP_Error('create_user', __('Could not create user'), $signup);
    }
    $now = current_time('mysql', true);
    if (empty($signup->domain)) {
        $wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
        if (isset($user_already_exists)) {
            return new WP_Error('user_already_exists', __('That username is already activated.'), $signup);
        }
        wpmu_welcome_user_notification($user_id, $password, $meta);
        add_new_user_to_blog($user_id, $user_email, $meta);
        do_action('wpmu_activate_user', $user_id, $password, $meta);
        return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
    }
    $blog_id = wpmu_create_blog($signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid);
    // TODO: What to do if we create a user but cannot create a blog?
    if (is_wp_error($blog_id)) {
        // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
        // setting the activation flag.  Let's just set the active flag and instruct the user to reset their password.
        if ('blog_taken' == $blog_id->get_error_code()) {
            $blog_id->add_data($signup);
            $wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
        }
        return $blog_id;
    }
    $wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
    wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta);
    do_action('wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta);
    return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
}
开发者ID:nhemsley,项目名称:wordpress,代码行数:74,代码来源:ms-functions.php


示例2: ms_activate_existing_user

 /**
  * Intersects with ``wpmu_activate_signup()`` through s2Member's Multisite Networking patch.
  *
  * This function should return the same array that `wpmu_activate_signup()` returns; with the assumption that ``$user_already_exists``.
  * 	Which is exactly where this function intersects inside the `/wp-includes/ms-functions.php`.
  *
  * This can ONLY be fired through `/wp-activate.php` on the front-side.
  * 	Or through `/activate` via BuddyPress.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_filter("_wpmu_activate_existing_error_");``
  *
  * @param obj $_error Expects a `WP_Error` object to be passed through by the Filter.
  * @param array $vars Expects the defined variables from the scope of the calling Filter.
  * @return obj|array If unable to add an existing User, the original ``$_error`` obj is returned.
  * 	Otherwise we return an array of User details for continued processing by the caller.
  */
 public static function ms_activate_existing_user($_error = FALSE, $vars = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_ms_activate_existing_user", get_defined_vars());
     unset($__refs, $__v);
     extract($vars);
     // Extract all variables from ``wpmu_activate_signup()`` function.
     if (is_multisite()) {
         // This event should ONLY be processed with Multisite Networking.
         if (!is_admin() && (preg_match("/\\/wp-activate\\.php/", $_SERVER["REQUEST_URI"]) || c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_activation_page())) {
             if (!empty($user_id) && !empty($user_login) && !empty($user_email) && !empty($password) && !empty($meta) && !empty($meta["add_to_blog"]) && !empty($meta["new_role"])) {
                 if (!empty($user_already_exists) && c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog($user_login, $user_email, $meta["add_to_blog"])) {
                     add_user_to_blog($meta["add_to_blog"], $user_id, $meta["new_role"]);
                     // Add this User to the specified Blog.
                     wp_update_user(array("ID" => $user_id, "user_pass" => $password));
                     // Update Password so it's the same as in the following msg.
                     wpmu_welcome_user_notification($user_id, $password, $meta);
                     // Send welcome letter via email just like ``wpmu_activate_signup()`` does.
                     do_action("wpmu_activate_user", $user_id, $password, $meta);
                     // Process Hook that would have been fired inside ``wpmu_activate_signup()``.
                     return apply_filters("ws_plugin__s2member_ms_activate_existing_user", array("user_id" => $user_id, "password" => $password, "meta" => $meta), get_defined_vars());
                 }
             }
         }
     }
     return apply_filters("ws_plugin__s2member_ms_activate_existing_user", $_error, get_defined_vars());
     // Else, return the standardized error.
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:49,代码来源:registrations.inc.php


示例3: wpmu_activate_signup

/**
 * Activate a signup.
 *
 * Hook to 'wpmu_activate_user' or 'wpmu_activate_blog' for events
 * that should happen only when users or sites are self-created (since
 * those actions are not called when users and sites are created
 * by a Super Admin).
 *
 * @since MU
 *
 * @global wpdb $wpdb
 *
 * @param string $key The activation key provided to the user.
 * @return array|WP_Error An array containing information about the activated user and/or blog
 */
function wpmu_activate_signup($key) {
	global $wpdb;

	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );

	if ( empty( $signup ) )
		return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );

	if ( $signup->active ) {
		if ( empty( $signup->domain ) )
			return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
		else
			return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
	}

	$meta = maybe_unserialize($signup->meta);
	$password = wp_generate_password( 12, false );

	$user_id = username_exists($signup->user_login);

	if ( ! $user_id )
		$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
	else
		$user_already_exists = true;

	if ( ! $user_id )
		return new WP_Error('create_user', __('Could not create user'), $signup);

	$now = current_time('mysql', true);

	if ( empty($signup->domain) ) {
		$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );

		if ( isset( $user_already_exists ) )
			return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);

		wpmu_welcome_user_notification( $user_id, $password, $meta );
		/**
		 * Fires immediately after a new user is activated.
		 *
		 * @since MU
		 *
		 * @param int   $user_id  User ID.
		 * @param int   $password User password.
		 * @param array $meta     Signup meta data.
		 */
		do_action( 'wpmu_activate_user', $user_id, $password, $meta );
		return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );
	}

	$blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid );

	// TODO: What to do if we create a user but cannot create a blog?
	if ( is_wp_error($blog_id) ) {
		// If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
		// setting the activation flag. Let's just set the active flag and instruct the user to reset their password.
		if ( 'blog_taken' == $blog_id->get_error_code() ) {
			$blog_id->add_data( $signup );
			$wpdb->update( $wpdb->signups, array( 'active' => 1, 'activated' => $now ), array( 'activation_key' => $key ) );
		}
		return $blog_id;
	}

	$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
	wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta);
	/**
	 * Fires immediately after a site is activated.
	 *
	 * @since MU
	 *
	 * @param int    $blog_id       Blog ID.
	 * @param int    $user_id       User ID.
	 * @param int    $password      User password.
	 * @param string $signup_title  Site title.
	 * @param array  $meta          Signup meta data.
	 */
	do_action( 'wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta );

	return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
}
开发者ID:nasrulhazim,项目名称:WordPress,代码行数:95,代码来源:ms-functions.php


示例4: ms_activate_existing_user

 /**
  * Intersects with ``wpmu_activate_signup()`` through s2Member's Multisite Networking patch.
  *
  * This function should return the same array that `wpmu_activate_signup()` returns; with the assumption that ``$user_already_exists``.
  *   Which is exactly where this function intersects inside the `/wp-includes/ms-functions.php`.
  *
  * This can ONLY be fired through `/wp-activate.php` on the front-side.
  *   Or through `/activate` via BuddyPress.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_filter('_wpmu_activate_existing_error_');``
  *
  * @param WP_Error $_error Expects a `WP_Error` object to be passed through by the Filter.
  * @param array    $vars Expects the defined variables from the scope of the calling Filter.
  *
  * @return WP_Error|array If unable to add an existing User, the original ``$_error`` obj is returned.
  *   Otherwise we return an array of User details for continued processing by the caller.
  */
 public static function ms_activate_existing_user($_error = NULL, $vars = array())
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_ms_activate_existing_user', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     extract($vars);
     // Extract all variables from ``wpmu_activate_signup()`` function.
     $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
     if (is_multisite()) {
         // This event should ONLY be processed with Multisite Networking.
         if (!is_admin() && (preg_match('/\\/wp-activate\\.php/' . $ci, $_SERVER['REQUEST_URI']) || c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_activation_page())) {
             if (!empty($user_id) && !empty($user_login) && !empty($user_email) && !empty($password) && !empty($meta) && !empty($meta['add_to_blog']) && !empty($meta['new_role'])) {
                 if (!empty($user_already_exists) && c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog($user_login, $user_email, $meta['add_to_blog'])) {
                     add_user_to_blog($meta['add_to_blog'], $user_id, $meta['new_role']);
                     // Add this User to the specified Blog.
                     wp_update_user(wp_slash(array('ID' => $user_id, 'user_pass' => $password)));
                     // Update Password so it's the same as in the following msg.
                     wpmu_welcome_user_notification($user_id, $password, $meta);
                     // Send welcome letter via email just like ``wpmu_activate_signup()`` does.
                     do_action('wpmu_activate_user', $user_id, $password, $meta);
                     // Process Hook that would have been fired inside ``wpmu_activate_signup()``.
                     return apply_filters('ws_plugin__s2member_ms_activate_existing_user', array('user_id' => $user_id, 'password' => $password, 'meta' => $meta), get_defined_vars());
                 }
             }
         }
     }
     return apply_filters('ws_plugin__s2member_ms_activate_existing_user', $_error, get_defined_vars());
     // Else, return the standardized error.
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:52,代码来源:registrations.inc.php


示例5: queue_process

 /**
  * Process queue for one blog
  *
  **/
 function queue_process($blog_ID, $site_ID)
 {
     global $wpdb;
     $query = $wpdb->prepare("SELECT * FROM {$wpdb->base_prefix}add_new_users_queue WHERE add_new_users_site_ID = '%d' AND add_new_users_blog_ID = '%d' LIMIT 1", $site_ID, $blog_ID);
     $users = $wpdb->get_results($query, ARRAY_A);
     if (count($users) > 0) {
         foreach ($users as $user) {
             $user['add_new_users_user_password'] = 'empty' !== $user['add_new_users_user_password'] ? $user['add_new_users_user_password'] : wp_generate_password();
             if (is_multisite()) {
                 $user_id = wpmu_create_user($user['add_new_users_user_login'], $user['add_new_users_user_password'], $user['add_new_users_user_email']);
             } else {
                 $user_id = wp_create_user($user['add_new_users_user_login'], $user['add_new_users_user_password'], $user['add_new_users_user_email']);
             }
             if ($user_id && !is_wp_error($user_id)) {
                 if (is_multisite()) {
                     add_user_to_blog($wpdb->blogid, $user_id, $user['add_new_users_user_role']);
                     wpmu_welcome_user_notification($user_id, $user['add_new_users_user_password'], '');
                 } else {
                     if (isset($user['add_new_users_user_role'])) {
                         $user_object = new WP_User($user_id);
                         $user_object->set_role($user['add_new_users_user_role']);
                     }
                     wp_new_user_notification($user_id, $user['add_new_users_user_password']);
                 }
                 $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->base_prefix}add_new_users_queue WHERE add_new_users_blog_ID = '%d' AND add_new_users_site_ID = '%d' AND add_new_users_ID = '%d'", $wpdb->blogid, $wpdb->siteid, $user['add_new_users_ID']));
             }
         }
     }
 }
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:33,代码来源:add-new-users.php



注:本文中的wpmu_welcome_user_notification函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpo_excerpt函数代码示例发布时间:2022-05-23
下一篇:
PHP wpmu_welcome_notification函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap