当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_core_get_user_email函数代码示例

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


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

示例1: populate

	/**
	 * populate()
	 *
	 * Populate the instantiated class with data based on the User ID provided.
	 *
	 * @package BuddyPress Core
 	 * @global $userdata WordPress user data for the current logged in user.
	 * @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id
	 * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
	 * @uses bp_core_get_user_email() Returns the email address for the user based on user ID
	 * @uses get_user_meta() WordPress function returns the value of passed usermeta name from usermeta table
	 * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
	 * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
	 */
	function populate() {
		if ( function_exists( 'xprofile_install' ) )
			$this->profile_data = $this->get_profile_data();

		if ( $this->profile_data ) {
			$this->user_url = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] );
			$this->fullname = esc_attr( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] );
			$this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
			$this->email = esc_attr( $this->profile_data['user_email'] );
		} else {
			$this->user_url = bp_core_get_user_domain( $this->id );
			$this->user_link = bp_core_get_userlink( $this->id );
			$this->fullname = esc_attr( bp_core_get_user_displayname( $this->id ) );
			$this->email = esc_attr( bp_core_get_user_email( $this->id ) );
		}

		/* Cache a few things that are fetched often */
		wp_cache_set( 'bp_user_fullname_' . $this->id, $this->fullname, 'bp' );
		wp_cache_set( 'bp_user_email_' . $this->id, $this->email, 'bp' );
		wp_cache_set( 'bp_user_url_' . $this->id, $this->user_url, 'bp' );

		$this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full' ) );
		$this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) );
		$this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) );

		$this->last_active = bp_core_get_last_activity( get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:41,代码来源:bp-core-classes.php

示例2: populate

 /**
  * populate()
  *
  * Populate the instantiated class with data based on the User ID provided.
  * 
  * @package BuddyPress Core
  * @global $userdata WordPress user data for the current logged in user.
  * @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id
  * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
  * @uses bp_core_get_user_email() Returns the email address for the user based on user ID
  * @uses get_usermeta() WordPress function returns the value of passed usermeta name from usermeta table
  * @uses bp_core_get_avatar() Returns HTML formatted avatar for a user
  * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
  */
 function populate()
 {
     $this->user_url = bp_core_get_userurl($this->id);
     $this->user_link = bp_core_get_userlink($this->id);
     $this->fullname = bp_fetch_user_fullname($this->id, false);
     $this->email = bp_core_get_user_email($this->id);
     $this->last_active = bp_core_get_last_activity(get_usermeta($this->id, 'last_activity'), __('active %s ago', 'buddypress'));
     $this->avatar = bp_core_get_avatar($this->id, 2);
     $this->avatar_thumb = bp_core_get_avatar($this->id, 1);
     $this->avatar_mini = bp_core_get_avatar($this->id, 1, 25, 25, false);
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:25,代码来源:bp-core-classes.php

示例3: bp_core_fetch_avatar


//.........这里部分代码省略.........
                 *
                 * @since 1.2.5
                 *
                 * @param string $avatar_url URL for a locally uploaded avatar.
                 * @param array  $params     Array of parameters for the request.
                 */
                return apply_filters('bp_core_fetch_avatar_url', $avatar_url, $params);
            }
        }
    }
    /**
     * Filters whether or not to skip Gravatar check.
     *
     * @since 1.5.0
     *
     * @param bool  $value  Whether or not to skip Gravatar.
     * @param array $params Array of parameters for the avatar request.
     */
    if (!apply_filters('bp_core_fetch_avatar_no_grav', $params['no_grav'], $params)) {
        // Set gravatar type
        if (empty($bp->grav_default->{$params['object']})) {
            $default_grav = 'wavatar';
        } elseif ('mystery' == $bp->grav_default->{$params['object']}) {
            /**
             * Filters the Mystery person avatar src value.
             *
             * @since 1.2.0
             *
             * @param string $value Avatar value.
             * @param string $value Width to display avatar at.
             */
            $default_grav = apply_filters('bp_core_mysteryman_src', 'mm', $params['width']);
        } else {
            $default_grav = $bp->grav_default->{$params['object']};
        }
        // Set gravatar object
        if (empty($params['email'])) {
            if ('user' == $params['object']) {
                $params['email'] = bp_core_get_user_email($params['item_id']);
            } elseif ('group' == $params['object'] || 'blog' == $params['object']) {
                $params['email'] = $params['item_id'] . '-' . $params['object'] . '@' . bp_get_root_domain();
            }
        }
        /**
         * Filters the Gravatar email to use.
         *
         * @since 1.1.0
         *
         * @param string $value Email to use in Gravatar request.
         * @param string $value ID of the item being requested.
         * @param string $value Object type being requested.
         */
        $params['email'] = apply_filters('bp_core_gravatar_email', $params['email'], $params['item_id'], $params['object']);
        /**
         * Filters the Gravatar URL host.
         *
         * @since 1.0.2
         *
         * @param string $value Gravatar URL host.
         */
        $gravatar = apply_filters('bp_gravatar_url', '//www.gravatar.com/avatar/');
        // Append email hash to Gravatar
        $gravatar .= md5(strtolower($params['email']));
        // Main Gravatar URL args
        $url_args = array('s' => $params['width']);
        // Custom Gravatar URL args
        if (!empty($params['force_default'])) {
            $url_args['f'] = 'y';
        }
        if (!empty($params['rating'])) {
            $url_args['r'] = strtolower($params['rating']);
        }
        // Only set default image if 'Gravatar Logo' is not requested
        if ('gravatar_default' !== $default_grav) {
            $url_args['d'] = $default_grav;
        }
        // Set up the Gravatar URL
        $gravatar = esc_url(add_query_arg(rawurlencode_deep(array_filter($url_args)), $gravatar));
        // No avatar was found, and we've been told not to use a gravatar.
    } else {
        /**
         * Filters the avatar default when Gravatar is not used.
         *
         * This is a variable filter dependent on the avatar type being requested.
         *
         * @since 1.5.0
         *
         * @param string $value  Default avatar for non-gravatar requests.
         * @param array  $params Array of parameters for the avatar request.
         */
        $gravatar = apply_filters('bp_core_default_avatar_' . $params['object'], bp_core_avatar_default('local'), $params);
    }
    if (true === $params['html']) {
        /** This filter is documented in bp-core/bp-core-avatars.php */
        return apply_filters('bp_core_fetch_avatar', '<img src="' . $gravatar . '"' . $html_css_id . $html_class . $html_width . $html_height . $html_alt . $html_title . $extra_attr . ' />', $params, $params['item_id'], $params['avatar_dir'], $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
    } else {
        /** This filter is documented in bp-core/bp-core-avatars.php */
        return apply_filters('bp_core_fetch_avatar_url', $gravatar, $params);
    }
}
开发者ID:toby-bushell,项目名称:triumph,代码行数:101,代码来源:bp-core-avatars.php

示例4: bp_core_fetch_avatar


//.........这里部分代码省略.........
                    $avatar_files[] = $avatar_file;
                }
            }
            // Check for array
            if (0 < count($avatar_files)) {
                // Check for current avatar
                foreach ($avatar_files as $key => $value) {
                    if (strpos($value, $avatar_size) !== false) {
                        $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                    }
                }
                // Legacy avatar check
                if (!isset($avatar_url)) {
                    foreach ($avatar_files as $key => $value) {
                        if (strpos($value, $legacy_user_avatar_name) !== false) {
                            $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                        }
                    }
                    // Legacy group avatar check
                    if (!isset($avatar_url)) {
                        foreach ($avatar_files as $key => $value) {
                            if (strpos($value, $legacy_group_avatar_name) !== false) {
                                $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                            }
                        }
                    }
                }
            }
        }
        // Close the avatar directory
        closedir($av_dir);
        // If we found a locally uploaded avatar
        if (isset($avatar_url)) {
            // Return it wrapped in an <img> element
            if (true === $html) {
                return apply_filters('bp_core_fetch_avatar', '<img src="' . $avatar_url . '" class="' . esc_attr($class) . '"' . $css_id . $html_width . $html_height . $html_alt . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
                // ...or only the URL
            } else {
                return apply_filters('bp_core_fetch_avatar_url', $avatar_url, $params);
            }
        }
    }
    // If no avatars could be found, try to display a gravatar
    // Skips gravatar check if $no_grav is passed
    if (!apply_filters('bp_core_fetch_avatar_no_grav', $no_grav)) {
        // Set gravatar size
        if (false !== $width) {
            $grav_size = $width;
        } else {
            if ('full' == $type) {
                $grav_size = bp_core_avatar_full_width();
            } else {
                if ('thumb' == $type) {
                    $grav_size = bp_core_avatar_thumb_width();
                }
            }
        }
        // Set gravatar type
        if (empty($bp->grav_default->{$object})) {
            $default_grav = 'wavatar';
        } else {
            if ('mystery' == $bp->grav_default->{$object}) {
                $default_grav = apply_filters('bp_core_mysteryman_src', 'mm', $grav_size);
            } else {
                $default_grav = $bp->grav_default->{$object};
            }
        }
        // Set gravatar object
        if (empty($email)) {
            if ('user' == $object) {
                $email = bp_core_get_user_email($item_id);
            } else {
                if ('group' == $object || 'blog' == $object) {
                    $email = "{$item_id}-{$object}@{bp_get_root_domain()}";
                }
            }
        }
        // Set host based on if using ssl
        $host = 'http://gravatar.com/avatar/';
        if (is_ssl()) {
            $host = 'https://secure.gravatar.com/avatar/';
        }
        // Filter gravatar vars
        $email = apply_filters('bp_core_gravatar_email', $email, $item_id, $object);
        $gravatar = apply_filters('bp_gravatar_url', $host) . md5(strtolower($email)) . '?d=' . $default_grav . '&amp;s=' . $grav_size;
        // Gravatar rating; http://bit.ly/89QxZA
        $rating = get_option('avatar_rating');
        if (!empty($rating)) {
            $gravatar .= "&amp;r={$rating}";
        }
        // No avatar was found, and we've been told not to use a gravatar.
    } else {
        $gravatar = apply_filters("bp_core_default_avatar_{$object}", bp_core_avatar_default('local'), $params);
    }
    if (true === $html) {
        return apply_filters('bp_core_fetch_avatar', '<img src="' . $gravatar . '" class="' . esc_attr($class) . '"' . $css_id . $html_width . $html_height . $html_alt . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
    } else {
        return apply_filters('bp_core_fetch_avatar_url', $gravatar, $params);
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:101,代码来源:bp-core-avatars.php

示例5: bp_core_fetch_avatar


//.........这里部分代码省略.........
				if ( 2 < strlen( $avatar_file ) )
					$avatar_files[] = $avatar_file;
			}

			// Check for array
			if ( 0 < count( $avatar_files ) ) {

				// Check for current avatar
				foreach( $avatar_files as $key => $value ) {
					if ( strpos ( $value, $avatar_size )!== false )
						$avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
				}

				// Legacy avatar check
				if ( !isset( $avatar_url ) ) {
					foreach( $avatar_files as $key => $value ) {
						if ( strpos ( $value, $legacy_user_avatar_name )!== false )
							$avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
					}

					// Legacy group avatar check
					if ( !isset( $avatar_url ) ) {
						foreach( $avatar_files as $key => $value ) {
							if ( strpos ( $value, $legacy_group_avatar_name )!== false )
								$avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
						}
					}
				}
			}
		}

		// Close the avatar directory
		closedir( $av_dir );

		// If we found a locally uploaded avatar
		if ( $avatar_url ) {

			// Return it wrapped in an <img> element
			if ( true === $html ) {
				return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );

			// ...or only the URL
			} else {
				return apply_filters( 'bp_core_fetch_avatar_url', $avatar_url );
			}
		}
	}

	// If no avatars could be found, try to display a gravatar

	// Skips gravatar check if $no_grav is passed
	if ( !$no_grav ) {

		// Set gravatar size
		if ( $width )
			$grav_size = $width;
		else if ( 'full' == $type )
			$grav_size = BP_AVATAR_FULL_WIDTH;
		else if ( 'thumb' == $type )
			$grav_size = BP_AVATAR_THUMB_WIDTH;

		// Set gravatar type
		if ( empty( $bp->grav_default->{$object} ) )
			$default_grav = 'wavatar';
		else if ( 'mystery' == $bp->grav_default->{$object} )
			$default_grav = apply_filters( 'bp_core_mysteryman_src', BP_AVATAR_DEFAULT, $grav_size );
		else
			$default_grav = $bp->grav_default->{$object};

		// Set gravatar object
		if ( empty( $email ) ) {
			if ( 'user' == $object ) {
				$email = bp_core_get_user_email( $item_id );
			} else if ( 'group' == $object || 'blog' == $object ) {
				$email = "{$item_id}-{$object}@{$bp->root_domain}";
			}
		}

		// Set host based on if using ssl
		if ( is_ssl() )
			$host = 'https://secure.gravatar.com/avatar/';
		else
			$host = 'http://www.gravatar.com/avatar/';

		// Filter gravatar vars
		$email		= apply_filters( 'bp_core_gravatar_email', $email, $item_id, $object );
		$gravatar	= apply_filters( 'bp_gravatar_url', $host ) . md5( strtolower( $email ) ) . '?d=' . $default_grav . '&amp;s=' . $grav_size;

		// Return gravatar wrapped in <img />
		if ( true === $html )
			return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );

		// ...or only return the gravatar URL
		else
			return apply_filters( 'bp_core_fetch_avatar_url', $gravatar );

	} else {
		return apply_filters( 'bp_core_fetch_avatar', false, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
	}
}
开发者ID:n-sane,项目名称:zaroka,代码行数:101,代码来源:bp-core-avatars.php

示例6: invite_anyone_already_accepted_redirect

/**
 * Catches attempts to reaccept an invitation, and redirects appropriately
 *
 * If you attempt to access the register page when logged in, you get bounced
 * to the home page. This is a BP feature. Because accept-invitation is a
 * subpage of register, this happens for accept-invitation pages as well.
 * However, people are more likely to try to visit this page than the vanilla
 * register page, because they've gotten an email inviting them to the site.
 *
 * So this function catches logged-in visits to /register/accept-invitation,
 * and if the email address in the URL matches the logged-in user's email
 * address, redirects them to their invite-anyone page to see the a message.
 *
 * @since 1.0.20
 */
function invite_anyone_already_accepted_redirect($redirect)
{
    global $bp;
    if (!invite_anyone_is_accept_invitation_page()) {
        return $redirect;
    }
    if (empty($_GET['email'])) {
        return $redirect;
    }
    $reg_email = urldecode($_GET['email']);
    if (bp_core_get_user_email(bp_loggedin_user_id()) !== $reg_email) {
        return $redirect;
    }
    $redirect = add_query_arg('already', 'accepted', trailingslashit(bp_loggedin_user_domain() . $bp->invite_anyone->slug));
    return $redirect;
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:31,代码来源:by-email.php

示例7: populate

 /**
  * Populate the instantiated class with data based on the User ID provided.
  *
  * @uses bp_core_get_userurl() Returns the URL with no HTML markup for
  *       a user based on their user id.
  * @uses bp_core_get_userlink() Returns a HTML formatted link for a
  *       user with the user's full name as the link text.
  * @uses bp_core_get_user_email() Returns the email address for the
  *       user based on user ID.
  * @uses bp_get_user_meta() BP function returns the value of passed
  *       usermeta name from usermeta table.
  * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
  * @uses bp_profile_last_updated_date() Returns the last updated date
  *       for a user.
  */
 public function populate()
 {
     if (bp_is_active('xprofile')) {
         $this->profile_data = $this->get_profile_data();
     }
     if (!empty($this->profile_data)) {
         $full_name_field_name = bp_xprofile_fullname_field_name();
         $this->user_url = bp_core_get_user_domain($this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login']);
         $this->fullname = esc_attr($this->profile_data[$full_name_field_name]['field_data']);
         $this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
         $this->email = esc_attr($this->profile_data['user_email']);
     } else {
         $this->user_url = bp_core_get_user_domain($this->id);
         $this->user_link = bp_core_get_userlink($this->id);
         $this->fullname = esc_attr(bp_core_get_user_displayname($this->id));
         $this->email = esc_attr(bp_core_get_user_email($this->id));
     }
     // Cache a few things that are fetched often
     wp_cache_set('bp_user_fullname_' . $this->id, $this->fullname, 'bp');
     wp_cache_set('bp_user_email_' . $this->id, $this->email, 'bp');
     wp_cache_set('bp_user_url_' . $this->id, $this->user_url, 'bp');
     $this->avatar = bp_core_fetch_avatar(array('item_id' => $this->id, 'type' => 'full', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->fullname)));
     $this->avatar_thumb = bp_core_fetch_avatar(array('item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->fullname)));
     $this->avatar_mini = bp_core_fetch_avatar(array('item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->fullname), 'width' => 30, 'height' => 30));
     $this->last_active = bp_core_get_last_activity(bp_get_user_last_activity($this->id), __('active %s', 'buddypress'));
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:41,代码来源:class-bp-core-user.php

示例8: bp_core_fetch_avatar


//.........这里部分代码省略.........
            $avatar_files = array();
            while (false !== ($avatar_file = readdir($av_dir))) {
                // Only add files to the array (skip directories)
                if (2 < strlen($avatar_file)) {
                    $avatar_files[] = $avatar_file;
                }
            }
            // Check for array
            if (0 < count($avatar_files)) {
                // Check for current avatar
                foreach ($avatar_files as $key => $value) {
                    if (strpos($value, $avatar_size) !== false) {
                        $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                    }
                }
                // Legacy avatar check
                if (!isset($avatar_url)) {
                    foreach ($avatar_files as $key => $value) {
                        if (strpos($value, $legacy_user_avatar_name) !== false) {
                            $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                        }
                    }
                    // Legacy group avatar check
                    if (!isset($avatar_url)) {
                        foreach ($avatar_files as $key => $value) {
                            if (strpos($value, $legacy_group_avatar_name) !== false) {
                                $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                            }
                        }
                    }
                }
            }
        }
        // Close the avatar directory
        closedir($av_dir);
        // If we found a locally uploaded avatar
        if (isset($avatar_url)) {
            // Return it wrapped in an <img> element
            if (true === $html) {
                return apply_filters('bp_core_fetch_avatar', '<img src="' . $avatar_url . '" alt="' . esc_attr($alt) . '" class="' . esc_attr($class) . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
                // ...or only the URL
            } else {
                return apply_filters('bp_core_fetch_avatar_url', $avatar_url);
            }
        }
    }
    // If no avatars could be found, try to display a gravatar
    // Skips gravatar check if $no_grav is passed
    if (!apply_filters('bp_core_fetch_avatar_no_grav', $no_grav)) {
        // Set gravatar size
        if ($width) {
            $grav_size = $width;
        } else {
            if ('full' == $type) {
                $grav_size = bp_core_avatar_full_width();
            } else {
                if ('thumb' == $type) {
                    $grav_size = bp_core_avatar_thumb_width();
                }
            }
        }
        // Set gravatar type
        if (empty($bp->grav_default->{$object})) {
            $default_grav = 'wavatar';
        } else {
            if ('mystery' == $bp->grav_default->{$object}) {
                $default_grav = apply_filters('bp_core_mysteryman_src', bp_core_avatar_default(), $grav_size);
            } else {
                $default_grav = $bp->grav_default->{$object};
            }
        }
        // Set gravatar object
        if (empty($email)) {
            if ('user' == $object) {
                $email = bp_core_get_user_email($item_id);
            } else {
                if ('group' == $object || 'blog' == $object) {
                    $email = "{$item_id}-{$object}@{bp_get_root_domain()}";
                }
            }
        }
        // Set host based on if using ssl
        if (is_ssl()) {
            $host = 'https://secure.gravatar.com/avatar/';
        } else {
            $host = 'http://www.gravatar.com/avatar/';
        }
        // Filter gravatar vars
        $email = apply_filters('bp_core_gravatar_email', $email, $item_id, $object);
        $gravatar = apply_filters('bp_gravatar_url', $host) . md5(strtolower($email)) . '?d=' . $default_grav . '&amp;s=' . $grav_size;
    } else {
        // No avatar was found, and we've been told not to use a gravatar.
        $gravatar = apply_filters("bp_core_default_avatar_{$object}", BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg', $params);
    }
    if (true === $html) {
        return apply_filters('bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . esc_attr($alt) . '" class="' . esc_attr($class) . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
    } else {
        return apply_filters('bp_core_fetch_avatar_url', $gravatar);
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:101,代码来源:bp-core-avatars.php

示例9: bpcs_bp_profile_email

 function bpcs_bp_profile_email($atts)
 {
     global $wpdb, $bp;
     extract(shortcode_atts(array("user_id" => $bp->loggedin_user->userdata->ID), $atts));
     $user_id = bpcs_get_user_id($user_id);
     return bp_core_get_user_email($user_id);
 }
开发者ID:Bento4Extend,项目名称:BuddyPress-Profile-Shortcodes,代码行数:7,代码来源:Bpsc_shortcodes.php

示例10: invite_anyone_activate_user

function invite_anyone_activate_user($user_id, $key, $user)
{
    global $bp;
    $email = bp_core_get_user_email($user_id);
    // Fire the query
    $invites = invite_anyone_get_invitations_by_invited_email($email);
    if ($invites->have_posts()) {
        // From the posts returned by the query, get a list of unique inviters
        $inviters = array();
        $groups = array();
        while ($invites->have_posts()) {
            $invites->the_post();
            $inviter_id = get_the_author_meta('ID');
            $inviters[] = $inviter_id;
            $groups_data = wp_get_post_terms(get_the_ID(), invite_anyone_get_invited_groups_tax_name());
            foreach ($groups_data as $group_data) {
                if (!isset($groups[$group_data->name])) {
                    // Keyed by inviter, which means they'll only get one invite per group
                    $groups[$group_data->name] = $inviter_id;
                }
            }
            // Mark as accepted
            update_post_meta(get_the_ID(), 'bp_ia_accepted', date('Y-m-d H:i:s'));
        }
        $inviters = array_unique($inviters);
        // Friendship requests
        if (bp_is_active('friends') && apply_filters('invite_anyone_send_friend_requests_on_acceptance', true)) {
            if (function_exists('friends_add_friend')) {
                foreach ($inviters as $inviter) {
                    friends_add_friend($inviter, $user_id);
                }
            }
        }
        // BuddyPress Followers support
        if (function_exists('bp_follow_start_following') && apply_filters('invite_anyone_send_follow_requests_on_acceptance', true)) {
            foreach ($inviters as $inviter) {
                bp_follow_start_following(array('leader_id' => $user_id, 'follower_id' => $inviter));
                bp_follow_start_following(array('leader_id' => $inviter, 'follower_id' => $user_id));
            }
        }
        // Group invitations
        if (bp_is_active('groups')) {
            foreach ($groups as $group_id => $inviter_id) {
                $args = array('user_id' => $user_id, 'group_id' => $group_id, 'inviter_id' => $inviter_id);
                groups_invite_user($args);
                groups_send_invites($inviter_id, $group_id);
            }
        }
    }
    do_action('accepted_email_invite', $user_id, $inviters);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:51,代码来源:by-email.php

示例11: user_avatar_fetch_avatar


//.........这里部分代码省略.........
        $html_width = " width=\"{$width}\"";
    } else {
        $html_width = 'thumb' == $type ? ' width="' . USER_AVATAR_THUMB_WIDTH . '"' : ' width="' . USER_AVATAR_FULL_WIDTH . '"';
    }
    // Set avatar height
    if ($height) {
        $html_height = " height=\"{$height}\"";
    } else {
        $html_height = 'thumb' == $type ? ' height="' . USER_AVATAR_THUMB_HEIGHT . '"' : ' height="' . USER_AVATAR_FULL_HEIGHT . '"';
    }
    // Check for directory
    if (file_exists($avatar_folder_dir)) {
        // Open directory
        if ($av_dir = opendir($avatar_folder_dir)) {
            // Stash files in an array once to check for one that matches
            $avatar_files = array();
            while (false !== ($avatar_file = readdir($av_dir))) {
                // Only add files to the array (skip directories)
                if (2 < strlen($avatar_file)) {
                    $avatar_files[] = $avatar_file;
                }
            }
            // Check for array
            if (0 < count($avatar_files)) {
                // Check for current avatar
                if (is_array($avatar_files)) {
                    foreach ($avatar_files as $key => $value) {
                        if (strpos($value, $avatar_size) !== false) {
                            $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                        }
                    }
                }
            }
        }
        // Close the avatar directory
        closedir($av_dir);
        // If we found a locally uploaded avatar
        if ($avatar_url) {
            // Return it wrapped in an <img> element
            if (true === $html) {
                return '<img src="' . $avatar_url . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />';
                // ...or only the URL
            } else {
                return $avatar_url;
            }
        }
    }
    // Skips gravatar check if $no_grav is passed
    if (!$no_grav) {
        // Set gravatar size
        if ($width) {
            $grav_size = $width;
        } else {
            if ('full' == $type) {
                $grav_size = USER_AVATAR_FULL_WIDTH;
            } else {
                if ('thumb' == $type) {
                    $grav_size = USER_AVATAR_THUMB_WIDTH;
                }
            }
        }
        // Set gravatar type
        if (empty($bp->grav_default->{$object})) {
            $default_grav = 'wavatar';
        } else {
            if ('mystery' == $bp->grav_default->{$object}) {
                $default_grav = apply_filters('bp_core_mysteryman_src', BP_AVATAR_DEFAULT, $grav_size);
            } else {
                $default_grav = $bp->grav_default->{$object};
            }
        }
        // Set gravatar object
        if (empty($email)) {
            if ('user' == $object) {
                $email = bp_core_get_user_email($item_id);
            } else {
                if ('group' == $object || 'blog' == $object) {
                    $email = "{$item_id}-{$object}@{$bp->root_domain}";
                }
            }
        }
        // Set host based on if using ssl
        if (is_ssl()) {
            $host = 'https://secure.gravatar.com/avatar/';
        } else {
            $host = 'http://www.gravatar.com/avatar/';
        }
        // Filter gravatar vars
        $email = apply_filters('bp_core_gravatar_email', $email, $item_id, $object);
        $gravatar = apply_filters('bp_gravatar_url', $host) . md5(strtolower($email)) . '?d=' . $default_grav . '&amp;s=' . $grav_size;
        // Return gravatar wrapped in <img />
        if (true === $html) {
            return apply_filters('bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
        } else {
            return $gravatar;
        }
    } else {
        return apply_filters('bp_core_fetch_avatar', false, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
    }
}
开发者ID:nottombrown,项目名称:vlab,代码行数:101,代码来源:user-avatar.php

示例12: send_warning

    function send_warning(&$cont, $flag_count)
    {
        $sitename = get_blog_option(BP_ROOT_BLOG, 'blogname');
        $siteurl = get_blog_option(BP_ROOT_BLOG, 'siteurl');
        $author_name = bp_core_get_user_displayname($cont->item_author);
        $author_email = bp_core_get_user_email($cont->item_author);
        $subject = "[{$sitename}] " . __('one of your contents has been reported as inappropriate', 'bp-moderation');
        $message = $this->options['warning_message'];
        $message = str_replace('%AUTHORNAME%', $author_name, $message);
        $message = str_replace('%CONTENTURL%', $cont->item_url, $message);
        $message = str_replace('%SITENAME%', $sitename, $message);
        $message = str_replace('%SITEURL%', $siteurl, $message);
        wp_mail($author_email, $subject, $message);
        $cont->status = 'warned';
        $cont->save();
        do_action('bp_moderation_content_warned', $cont->content_id, $cont);
        if ($this->options['warning_forward']) {
            $admin_subject = "[{$sitename}] " . sprintf(__('a warning for inappropriate content has been sent to %s', 'bp-moderation'), $author_name);
            $admin_msg_prefix = sprintf(__('Content url: %1$s
Total flags: %2$s
Author profile: %3$s

----- Message sent to the author -----
', 'bp-moderation'), $cont->item_url, $flag_count, bp_core_get_user_domain($cont->item_author));
            wp_mail($this->options['warning_forward'], $admin_subject, $admin_msg_prefix . $message);
        }
    }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:27,代码来源:bpModActions.php

示例13: rendez_vous_notify_organizer

/**
 * Send a screen notifications & email one when an attendee set his preferences
 *
 * @package Rendez Vous
 * @subpackage Notifications
 *
 * @since Rendez Vous (1.0.0)
 */
function rendez_vous_notify_organizer($args = array(), $attendee_id = 0, $rendez_vous = null)
{
    $bp = buddypress();
    if (empty($attendee_id) || empty($rendez_vous) || $attendee_id == $rendez_vous->organizer) {
        return;
    }
    // Screen Notification
    bp_notifications_add_notification(array('user_id' => $rendez_vous->organizer, 'item_id' => $rendez_vous->id, 'secondary_item_id' => $attendee_id, 'component_name' => $bp->rendez_vous->id, 'component_action' => 'rendez_vous_schedule'));
    // Sending Emails
    if ('no' == get_user_meta($rendez_vous->organizer, 'notification_rendez_vous_schedule', true)) {
        return;
    }
    $rendez_vous_link = rendez_vous_get_single_link($rendez_vous->id, $rendez_vous->organizer);
    $rendez_vous_title = stripslashes($rendez_vous->title);
    $rendez_vous_content = wp_kses($rendez_vous_title, array());
    $attendee_name = bp_core_get_user_displayname($attendee_id);
    $attendee_name = stripslashes($attendee_name);
    $organizer_settings = false;
    $organizer_profile = bp_core_get_user_domain($rendez_vous->organizer);
    $organizer_email = bp_core_get_user_email($rendez_vous->organizer);
    $message = sprintf(__("%s set their preferences for the rendez-vous: %s\n\nTo view details, log in and visit: %s\n\n---------------------\n", 'rendez-vous'), $attendee_name, $rendez_vous_content, esc_url($rendez_vous_link));
    $subject = bp_get_email_subject(array('text' => sprintf(__('%s selected date(s) for a rendez-vous', 'rendez-vous'), $attendee_name)));
    // Set up and send the message
    $to = $organizer_email;
    // Only show the disable notifications line if the settings component is enabled
    if (bp_is_active('settings')) {
        $organizer_settings = trailingslashit($organizer_profile . bp_get_settings_slug() . '/notifications');
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'rendez-vous'), esc_url($organizer_settings));
    }
    /* Send the message */
    $to = apply_filters('rendez_vous_userset_notify_organizer', $to);
    $subject = apply_filters('rendez_vous_userset_notify_subject', $subject, $attendee_name);
    $mail_content = apply_filters('rendez_vous_userset_notify_message', $message, $rendez_vous, $attendee_name, $rendez_vous_content, $rendez_vous_link, $organizer_settings);
    wp_mail($to, $subject, $mail_content);
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:43,代码来源:rendez-vous-notifications.php

示例14: invite_anyone_activate_user

function invite_anyone_activate_user($user_id, $key, $user)
{
    global $bp;
    $email = bp_core_get_user_email($user_id);
    if ($invites = invite_anyone_get_invitations_by_invited_email($email)) {
        // Mark as "is_joined"
        invite_anyone_mark_as_joined($email);
        // Friendship requests
        if (bp_is_active('friends')) {
            $inviters = array();
            foreach ($invites as $invite) {
                if (!in_array($invite->inviter_id, $inviters)) {
                    $inviters[] = $invite->inviter_id;
                }
            }
            if (function_exists('friends_add_friend')) {
                foreach ($inviters as $inviter) {
                    friends_add_friend($inviter, $user_id);
                }
            }
        }
        // BuddyPress Followers support
        if (function_exists('bp_follow_start_following')) {
            $inviters = array();
            foreach ($invites as $invite) {
                if (!in_array($invite->inviter_id, $inviters)) {
                    $inviters[] = $invite->inviter_id;
                }
            }
            foreach ($inviters as $inviter) {
                bp_follow_start_following(array('leader_id' => $user_id, 'follower_id' => $inviter));
                bp_follow_start_following(array('leader_id' => $inviter, 'follower_id' => $user_id));
            }
        }
        // BuddyPress Followers support
        if (function_exists('bp_follow_start_following')) {
            $inviters = array();
            foreach ($invites as $invite) {
                if (!in_array($invite->inviter_id, $inviters)) {
                    $inviters[] = $invite->inviter_id;
                }
            }
            foreach ($inviters as $inviter) {
                bp_follow_start_following(array('leader_id' => $user_id, 'follower_id' => $inviter));
                bp_follow_start_following(array('leader_id' => $inviter, 'follower_id' => $user_id));
            }
        }
        // Group invitations
        if (bp_is_active('groups')) {
            $groups = array();
            foreach ($invites as $invite) {
                if (!$invite->group_invitations[0]) {
                    continue;
                } else {
                    $group_invitations = unserialize($invite->group_invitations);
                }
                foreach ($group_invitations as $group) {
                    if (!in_array($group, array_keys($groups))) {
                        $groups[$group] = $invite->inviter_id;
                    }
                }
            }
            foreach ($groups as $group_id => $inviter_id) {
                $args = array('user_id' => $user_id, 'group_id' => $group_id, 'inviter_id' => $inviter_id);
                groups_invite_user($args);
                groups_send_invites($inviter_id, $group_id);
            }
        }
    }
    do_action('accepted_email_invite', $user_id, $inviters);
}
开发者ID:hnla,项目名称:invite-anyone,代码行数:71,代码来源:by-email.php

示例15: bp_core_fetch_avatar


//.........这里部分代码省略.........
     * Look for uploaded avatar first. Use it if it exists.
     * Set the file names to search for, to select the full size
     * or thumbnail image.
     */
    $avatar_size = 'full' == $params['type'] ? '-bpfull' : '-bpthumb';
    $legacy_user_avatar_name = 'full' == $params['type'] ? '-avatar2' : '-avatar1';
    $legacy_group_avatar_name = 'full' == $params['type'] ? '-groupavatar-full' : '-groupavatar-thumb';
    // Check for directory
    if (file_exists($avatar_folder_dir)) {
        // Open directory
        if ($av_dir = opendir($avatar_folder_dir)) {
            // Stash files in an array once to check for one that matches
            $avatar_files = array();
            while (false !== ($avatar_file = readdir($av_dir))) {
                // Only add files to the array (skip directories)
                if (2 < strlen($avatar_file)) {
                    $avatar_files[] = $avatar_file;
                }
            }
            // Check for array
            if (0 < count($avatar_files)) {
                // Check for current avatar
                foreach ($avatar_files as $key => $value) {
                    if (strpos($value, $avatar_size) !== false) {
                        $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                    }
                }
                // Legacy avatar check
                if (!isset($avatar_url)) {
                    foreach ($avatar_files as $key => $value) {
                        if (strpos($value, $legacy_user_avatar_name) !== false) {
                            $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                        }
                    }
                    // Legacy group avatar check
                    if (!isset($avatar_url)) {
                        foreach ($avatar_files as $key => $value) {
                            if (strpos($value, $legacy_group_avatar_name) !== false) {
                                $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
                            }
                        }
                    }
                }
            }
        }
        // Close the avatar directory
        closedir($av_dir);
        // If we found a locally uploaded avatar
        if (isset($avatar_url)) {
            // Return it wrapped in an <img> element
            if (true === $params['html']) {
                return apply_filters('bp_core_fetch_avatar', '<img src="' . $avatar_url . '"' . $html_class . $html_css_id . $html_width . $html_height . $html_alt . $html_title . ' />', $params, $params['item_id'], $params['avatar_dir'], $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
                // ...or only the URL
            } else {
                return apply_filters('bp_core_fetch_avatar_url', $avatar_url, $params);
            }
        }
    }
    // If no avatars could be found, try to display a gravatar
    // Skips gravatar check if $params['no_grav'] is passed
    if (!apply_filters('bp_core_fetch_avatar_no_grav', $params['no_grav'], $params)) {
        // Set gravatar type
        if (empty($bp->grav_default->{$params['object']})) {
            $default_grav = 'wavatar';
        } elseif ('mystery' == $bp->grav_default->{$params['object']}) {
            $default_grav = apply_filters('bp_core_mysteryman_src', 'mm', $params['width']);
        } else {
            $default_grav = $bp->grav_default->{$params['object']};
        }
        // Set gravatar object
        if (empty($params['email'])) {
            if ('user' == $params['object']) {
                $params['email'] = bp_core_get_user_email($params['item_id']);
            } elseif ('group' == $params['object'] || 'blog' == $params['object']) {
                $params['email'] = $params['item_id'] . '-' . $params['object'] . '@' . bp_get_root_domain();
            }
        }
        // Set host based on if using ssl
        $host = 'http://gravatar.com/avatar/';
        if (is_ssl()) {
            $host = 'https://secure.gravatar.com/avatar/';
        }
        // Filter gravatar vars
        $params['email'] = apply_filters('bp_core_gravatar_email', $params['email'], $params['item_id'], $params['object']);
        $gravatar = apply_filters('bp_gravatar_url', $host) . md5(strtolower($params['email'])) . '?d=' . $default_grav . '&amp;s=' . $params['width'];
        // Gravatar rating; http://bit.ly/89QxZA
        $rating = get_option('avatar_rating');
        if (!empty($rating)) {
            $gravatar .= "&amp;r={$rating}";
        }
        // No avatar was found, and we've been told not to use a gravatar.
    } else {
        $gravatar = apply_filters('bp_core_default_avatar_' . $params['object'], bp_core_avatar_default('local'), $params);
    }
    if (true === $params['html']) {
        return apply_filters('bp_core_fetch_avatar', '<img src="' . $gravatar . '"' . $html_css_id . $html_class . $html_width . $html_height . $html_alt . $html_title . ' />', $params, $params['item_id'], $params['avatar_dir'], $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir);
    } else {
        return apply_filters('bp_core_fetch_avatar_url', $gravatar, $params);
    }
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:101,代码来源:bp-core-avatars.php


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