Beispiel #1
0
/**
 * Set up global variables related to avatars.
 *
 * @since BuddyPress (1.5.0)
 */
function bp_core_set_avatar_globals()
{
    $bp = buddypress();
    $bp->avatar = new stdClass();
    $bp->avatar->thumb = new stdClass();
    $bp->avatar->full = new stdClass();
    // Dimensions
    $bp->avatar->thumb->width = BP_AVATAR_THUMB_WIDTH;
    $bp->avatar->thumb->height = BP_AVATAR_THUMB_HEIGHT;
    $bp->avatar->full->width = BP_AVATAR_FULL_WIDTH;
    $bp->avatar->full->height = BP_AVATAR_FULL_HEIGHT;
    // Upload maximums
    $bp->avatar->original_max_width = BP_AVATAR_ORIGINAL_MAX_WIDTH;
    $bp->avatar->original_max_filesize = BP_AVATAR_ORIGINAL_MAX_FILESIZE;
    // Defaults
    $bp->avatar->thumb->default = bp_core_avatar_default_thumb();
    $bp->avatar->full->default = bp_core_avatar_default();
    // These have to be set on page load in order to avoid infinite filter loops at runtime
    $bp->avatar->upload_path = bp_core_avatar_upload_path();
    $bp->avatar->url = bp_core_avatar_url();
    // Cache the root blog's show_avatars setting, to avoid unnecessary
    // calls to switch_to_blog()
    $bp->avatar->show_avatars = (bool) BP_SHOW_AVATARS;
    // Backpat for pre-1.5
    if (!defined('BP_AVATAR_UPLOAD_PATH')) {
        define('BP_AVATAR_UPLOAD_PATH', $bp->avatar->upload_path);
    }
    // Backpat for pre-1.5
    if (!defined('BP_AVATAR_URL')) {
        define('BP_AVATAR_URL', $bp->avatar->url);
    }
    do_action('bp_core_set_avatar_globals');
}
 /**
  * Set up the title for pages and <title>.
  */
 public function setup_title()
 {
     if (bp_is_groups_component()) {
         $bp = buddypress();
         if (bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_title = _x('Memberships', 'My Groups page <title>', 'buddypress');
         } elseif (!bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
             // We are viewing a single group, so set up the
             // group navigation menu using the $this->current_group global.
         } elseif (bp_is_single_item()) {
             $bp->bp_options_title = $this->current_group->name;
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => $this->current_group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __('Group Profile Photo', 'buddypress')));
             if (empty($bp->bp_options_avatar)) {
                 $bp->bp_options_avatar = '<img src="' . esc_url(bp_core_avatar_default_thumb()) . '" alt="' . esc_attr__('No Group Profile Photo', 'buddypress') . '" class="avatar" />';
             }
         }
     }
     parent::setup_title();
 }