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


PHP bp_disable_group_avatar_uploads函数代码示例

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


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

示例1: while

?>

<?php 
if (bp_has_groups('type=invites&user_id=' . bp_loggedin_user_id())) {
    ?>

	<ul id="group-list" class="invites item-list">

		<?php 
    while (bp_groups()) {
        bp_the_group();
        ?>

			<li>
				<?php 
        if (!bp_disable_group_avatar_uploads()) {
            ?>
					<div class="item-avatar">
						<a href="<?php 
            bp_group_permalink();
            ?>
"><?php 
            bp_group_avatar('type=thumb&width=50&height=50');
            ?>
</a>
					</div>
				<?php 
        }
        ?>

				<h4><a href="<?php 
开发者ID:un1coin,项目名称:ovn-space,代码行数:31,代码来源:invites.php

示例2: bp_get_group_avatar

/**
 * Get a group's avatar.
 *
 * @since 1.0.0
 *
 * @see bp_core_fetch_avatar() For a description of arguments and return values.
 * @param array|string $args {
 *     Arguments are listed here with an explanation of their defaults.
 *     For more information about the arguments, see {@link bp_core_fetch_avatar()}.
 *
 *     @type string   $alt     Default: 'Group logo of [group name]'.
 *     @type string   $class   Default: 'avatar'.
 *     @type string   $type    Default: 'full'.
 *     @type int|bool $width   Default: false.
 *     @type int|bool $height  Default: false.
 *     @type bool     $id      Passed to `$css_id` parameter.
 * }
 * @return string Group avatar string.
 */
function bp_get_group_avatar($args = '')
{
    global $groups_template;
    // Bail if avatars are turned off.
    if (bp_disable_group_avatar_uploads() || !buddypress()->avatar->show_avatars) {
        return false;
    }
    // Parse the arguments.
    $r = bp_parse_args($args, array('type' => 'full', 'width' => false, 'height' => false, 'class' => 'avatar', 'id' => false, 'alt' => sprintf(__('Group logo of %s', 'buddypress'), $groups_template->group->name)));
    // Fetch the avatar from the folder.
    $avatar = bp_core_fetch_avatar(array('item_id' => $groups_template->group->id, 'title' => $groups_template->group->name, 'avatar_dir' => 'group-avatars', 'object' => 'group', 'type' => $r['type'], 'alt' => $r['alt'], 'css_id' => $r['id'], 'class' => $r['class'], 'width' => $r['width'], 'height' => $r['height']));
    // If No avatar found, provide some backwards compatibility.
    if (empty($avatar)) {
        $avatar = '<img src="' . esc_url($groups_template->group->avatar_thumb) . '" class="avatar" alt="' . esc_attr($groups_template->group->name) . '" />';
    }
    /**
     * Filters the group avatar while in the groups loop.
     *
     * @since 1.0.0
     *
     * @param string $avatar HTML image element holding the group avatar.
     * @param array  $r      Array of parsed arguments for the group avatar.
     */
    return apply_filters('bp_get_group_avatar', $avatar, $r);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:44,代码来源:bp-groups-template.php

示例3: bp_avatar_is_front_edit

/**
 * Checks whether Avatar UI should be loaded.
 *
 * @since  2.3.0
 *
 * @return bool True if Avatar UI should load, false otherwise.
 */
function bp_avatar_is_front_edit()
{
    $retval = false;
    // No need to carry on if the current WordPress version is not supported.
    if (!bp_attachments_is_wp_version_supported()) {
        return $retval;
    }
    if (bp_is_user_change_avatar() && 'crop-image' !== bp_get_avatar_admin_step()) {
        $retval = !bp_core_get_root_option('bp-disable-avatar-uploads');
    }
    if (bp_is_active('groups')) {
        // Group creation
        if (bp_is_group_create() && bp_is_group_creation_step('group-avatar') && 'crop-image' !== bp_get_avatar_admin_step()) {
            $retval = !bp_disable_group_avatar_uploads();
            // Group Manage
        } elseif (bp_is_group_admin_page() && bp_is_group_admin_screen('group-avatar') && 'crop-image' !== bp_get_avatar_admin_step()) {
            $retval = !bp_disable_group_avatar_uploads();
        }
    }
    /**
     * Use this filter if you need to :
     * - Load the avatar UI for a component that is !groups or !user (return true regarding your conditions)
     * - Completely disable the avatar UI introduced in 2.3 (eg: __return_false())
     *
     * @since  2.3.0
     *
     * @param bool whether to load the Avatar UI.
     */
    return apply_filters('bp_avatar_is_front_edit', $retval);
}
开发者ID:toby-bushell,项目名称:triumph,代码行数:37,代码来源:bp-core-avatars.php

示例4: groups_screen_group_admin_avatar

/**
 * Handle the display of a group's Change Avatar page.
 */
function groups_screen_group_admin_avatar()
{
    if ('group-avatar' != bp_get_group_current_admin_tab()) {
        return false;
    }
    // If the logged-in user doesn't have permission or if avatar uploads are disabled, then stop here.
    if (!bp_is_item_admin() || bp_disable_group_avatar_uploads() || !buddypress()->avatar->show_avatars) {
        return false;
    }
    $bp = buddypress();
    // If the group admin has deleted the admin avatar.
    if (bp_is_action_variable('delete', 1)) {
        // Check the nonce.
        check_admin_referer('bp_group_avatar_delete');
        if (bp_core_delete_existing_avatar(array('item_id' => $bp->groups->current_group->id, 'object' => 'group'))) {
            bp_core_add_message(__('The group profile photo was deleted successfully!', 'buddypress'));
        } else {
            bp_core_add_message(__('There was a problem deleting the group profile photo. Please try again.', 'buddypress'), 'error');
        }
    }
    if (!isset($bp->avatar_admin)) {
        $bp->avatar_admin = new stdClass();
    }
    $bp->avatar_admin->step = 'upload-image';
    if (!empty($_FILES)) {
        // Check the nonce.
        check_admin_referer('bp_avatar_upload');
        // Pass the file to the avatar upload handler.
        if (bp_core_avatar_handle_upload($_FILES, 'groups_avatar_upload_dir')) {
            $bp->avatar_admin->step = 'crop-image';
            // Make sure we include the jQuery jCrop file for image cropping.
            add_action('wp_print_scripts', 'bp_core_add_jquery_cropper');
        }
    }
    // If the image cropping is done, crop the image and save a full/thumb version.
    if (isset($_POST['avatar-crop-submit'])) {
        // Check the nonce.
        check_admin_referer('bp_avatar_cropstore');
        $args = array('object' => 'group', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h']);
        if (!bp_core_avatar_handle_crop($args)) {
            bp_core_add_message(__('There was a problem cropping the group profile photo.', 'buddypress'), 'error');
        } else {
            bp_core_add_message(__('The new group profile photo was uploaded successfully.', 'buddypress'));
        }
    }
    /**
     * Fires before the loading of the group Change Avatar page template.
     *
     * @since 1.0.0
     *
     * @param int $id ID of the group that is being displayed.
     */
    do_action('groups_screen_group_admin_avatar', $bp->groups->current_group->id);
    /**
     * Filters the template to load for a group's Change Avatar page.
     *
     * @since 1.0.0
     *
     * @param string $value Path to a group's Change Avatar template.
     */
    bp_core_load_template(apply_filters('groups_template_group_admin_avatar', 'groups/single/home'));
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:65,代码来源:bp-groups-screens.php

示例5: bp_admin_setting_callback_group_avatar_uploads

/**
 * 'Enable group avatars' field markup.
 *
 * @since 2.3.0
 */
function bp_admin_setting_callback_group_avatar_uploads()
{
    ?>
	<input id="bp-disable-group-avatar-uploads" name="bp-disable-group-avatar-uploads" type="checkbox" value="1" <?php 
    checked(!bp_disable_group_avatar_uploads());
    ?>
 />
	<label for="bp-disable-group-avatar-uploads"><?php 
    _e('Allow customizable avatars for groups', 'buddypress');
    ?>
</label>
<?php 
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:18,代码来源:bp-core-admin-settings.php

示例6: setup_nav

 /**
  * Set up component navigation.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use.
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         $user_domain = false;
     }
     // Only grab count if we're on a user page.
     if (bp_is_user()) {
         $count = bp_get_total_group_count_for_user();
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(_x('Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     } else {
         $nav_name = _x('Groups', 'Group screen nav without counter', 'buddypress');
     }
     $slug = bp_get_groups_slug();
     // Add 'Groups' to the main navigation.
     $main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $this->id);
     if (!empty($user_domain)) {
         $access = bp_core_can_edit_settings();
         $groups_link = trailingslashit($user_domain . $slug);
         // Add the My Groups nav item.
         $sub_nav[] = array('name' => __('Memberships', 'buddypress'), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups');
         // Add the Group Invites nav item.
         $sub_nav[] = array('name' => __('Invitations', 'buddypress'), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $slug, 'screen_function' => 'groups_screen_group_invites', 'user_has_access' => $access, 'position' => 30);
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (bp_is_groups_component() && bp_is_single_item()) {
         // Reset sub nav.
         $sub_nav = array();
         // Add 'Groups' to the main navigation.
         $main_nav = array('name' => __('Memberships', 'buddypress'), 'slug' => $this->current_group->slug, 'position' => -1, 'screen_function' => 'groups_screen_group_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
         $group_link = bp_get_group_permalink($this->current_group);
         // Add the "Home" subnav item, as this will always be present.
         $sub_nav[] = array('name' => _x('Home', 'Group screen navigation title', 'buddypress'), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home');
         // If this is a private group, and the user is not a
         // member and does not have an outstanding invitation,
         // show a "Request Membership" nav item.
         if (is_user_logged_in() && !$this->current_group->is_user_member && !groups_check_for_membership_request(bp_loggedin_user_id(), $this->current_group->id) && $this->current_group->status == 'private' && !groups_check_user_has_invite(bp_loggedin_user_id(), $this->current_group->id)) {
             $sub_nav[] = array('name' => _x('Request Membership', 'Group screen nav', 'buddypress'), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30);
         }
         // Forums are enabled and turned on.
         if ($this->current_group->enable_forum && bp_is_active('forums')) {
             $sub_nav[] = array('name' => _x('Forum', 'My Group screen nav', 'buddypress'), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'forums');
         }
         if ($this->current_group->front_template || bp_is_active('activity')) {
             /**
              * If the theme is using a custom front, create activity subnav.
              */
             if ($this->current_group->front_template && bp_is_active('activity')) {
                 $sub_nav[] = array('name' => _x('Activity', 'My Group screen nav', 'buddypress'), 'slug' => 'activity', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_activity', 'position' => 11, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'activity', 'no_access_url' => $group_link);
             }
             /**
              * Only add the members subnav if it's not the home's nav.
              */
             $sub_nav[] = array('name' => sprintf(_x('Members %s', 'My Group screen nav', 'buddypress'), '<span>' . number_format($this->current_group->total_member_count) . '</span>'), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'members', 'no_access_url' => $group_link);
         }
         if (bp_is_active('friends') && bp_groups_user_can_send_invites()) {
             $sub_nav[] = array('name' => _x('Send Invites', 'My Group screen nav', 'buddypress'), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $this->current_group->user_has_access, 'no_access_url' => $group_link);
         }
         // If the user is a group admin, then show the group admin nav item.
         if (bp_is_item_admin()) {
             $sub_nav[] = array('name' => _x('Manage', 'My Group screen nav', 'buddypress'), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin', 'no_access_url' => $group_link);
             $admin_link = trailingslashit($group_link . 'admin');
             // Common params to all nav items.
             $default_params = array('parent_url' => $admin_link, 'parent_slug' => $this->current_group->slug . '_manage', 'screen_function' => 'groups_screen_group_admin', 'user_has_access' => bp_is_item_admin(), 'show_in_admin_bar' => true);
             $sub_nav[] = array_merge(array('name' => __('Details', 'buddypress'), 'slug' => 'edit-details', 'position' => 0), $default_params);
             $sub_nav[] = array_merge(array('name' => __('Settings', 'buddypress'), 'slug' => 'group-settings', 'position' => 10), $default_params);
             if (!bp_disable_group_avatar_uploads() && buddypress()->avatar->show_avatars) {
                 $sub_nav[] = array_merge(array('name' => __('Photo', 'buddypress'), 'slug' => 'group-avatar', 'position' => 20), $default_params);
             }
             if (bp_group_use_cover_image_header()) {
                 $sub_nav[] = array_merge(array('name' => __('Cover Image', 'buddypress'), 'slug' => 'group-cover-image', 'position' => 25), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Members', 'buddypress'), 'slug' => 'manage-members', 'position' => 30), $default_params);
             if ('private' == $this->current_group->status) {
                 $sub_nav[] = array_merge(array('name' => __('Requests', 'buddypress'), 'slug' => 'membership-requests', 'position' => 40), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Delete', 'buddypress'), 'slug' => 'delete-group', 'position' => 1000), $default_params);
         }
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (isset($this->current_group->user_has_access)) {
         /**
          * Fires at the end of the groups navigation setup if user has access.
          *
          * @since 1.0.2
//.........这里部分代码省略.........
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:101,代码来源:bp-groups-loader.php

示例7: rw_bp_docs_set_the_doc_relatetd_group

function rw_bp_docs_set_the_doc_relatetd_group()
{
    $d_doc_id = $folder_id = $group_id = 0;
    $group = new stdClass();
    $url = '#';
    $description = '';
    if (bp_docs_is_existing_doc()) {
        $d_doc_id = get_queried_object_id();
        $folder_id = bp_docs_get_doc_folder($d_doc_id);
        if ($folder_id) {
            $group_id = bp_docs_get_folder_group($folder_id);
            if ($group_id) {
                $group = groups_get_group(array('group_id' => $group_id));
                buddypress()->groups->current_group = $group;
                if (!bp_disable_group_avatar_uploads()) {
                    $url = bp_get_groups_root_slug() . '/' . $group->slug;
                }
                $avatar = bp_get_group_avatar('type=thumb&width=250&height=250');
                $description = $group->description;
                $name = $group->name;
            }
        } else {
            $post = get_post($d_doc_id);
            $user = get_userdata($post->post_author);
            $name = $user->display_name;
            $avatar = bp_core_fetch_avatar(array('type' => 'thumb', 'width' => 250, 'height' => 250, 'item_id' => $user->ID));
            $description = '';
            $url = bp_get_members_root_slug() . '/' . $user->nice_name;
        }
    }
    ?>
	<div id="bp_docs_sitebar_info">
		<h2><a href="/<?php 
    echo $url;
    ?>
"><?php 
    echo $name;
    ?>
</a></h2>
		<div class="group-avatar">
			<a href="/<?php 
    echo $url;
    ?>
"><?php 
    echo $avatar;
    ?>
</a>
		</div>
		
		<div class="group-info">
			<p><?php 
    echo $description;
    ?>
</p>
		</div>
	</div>
	<hr>
	<?php 
}
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:59,代码来源:rw_functions.php

示例8: bp_get_activity_secondary_avatar

/**
 * Return the avatar of the object that action was performed on.
 *
 * @since 1.2.0
 *
 * @see bp_core_fetch_avatar() for description of arguments.
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses wp_parse_args()
 * @uses get_blog_option()
 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component hook.
 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_item_id' hook.
 * @uses bp_core_fetch_avatar()
 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar' hook.
 *
 * @param array|string $args  {
 *     For a complete description of arguments, see {@link bp_core_fetch_avatar()}.
 *     @type string      $alt     Default value varies based on current activity
 *                                item component.
 *     @type string      $type    Default: 'full' when viewing a single activity
 *                                permalink page, otherwise 'thumb'.
 *     @type string      $class   Default: 'avatar'.
 *     @type string|bool $email   Default: email of the activity's user.
 *     @type int|bool    $user_id Default: ID of the activity's user.
 * }
 * @return string The secondary avatar.
 */
function bp_get_activity_secondary_avatar($args = '')
{
    global $activities_template;
    $r = wp_parse_args($args, array('alt' => '', 'type' => 'thumb', 'width' => 20, 'height' => 20, 'class' => 'avatar', 'link_class' => '', 'linked' => true, 'email' => false));
    extract($r, EXTR_SKIP);
    // Set item_id and object (default to user).
    switch ($activities_template->activity->component) {
        case 'groups':
            if (bp_disable_group_avatar_uploads()) {
                return false;
            }
            $object = 'group';
            $item_id = $activities_template->activity->item_id;
            $link = '';
            $name = '';
            // Only if groups is active.
            if (bp_is_active('groups')) {
                $group = groups_get_group(array('group_id' => $item_id, 'populate_extras' => false, 'update_meta_cache' => false));
                $link = bp_get_group_permalink($group);
                $name = $group->name;
            }
            if (empty($alt)) {
                $alt = __('Group logo', 'buddypress');
                if (!empty($name)) {
                    $alt = sprintf(__('Group logo of %s', 'buddypress'), $name);
                }
            }
            break;
        case 'blogs':
            $object = 'blog';
            $item_id = $activities_template->activity->item_id;
            $link = home_url();
            if (empty($alt)) {
                $alt = sprintf(__('Profile picture of the author of the site %s', 'buddypress'), get_blog_option($item_id, 'blogname'));
            }
            break;
        case 'friends':
            $object = 'user';
            $item_id = $activities_template->activity->secondary_item_id;
            $link = bp_core_get_userlink($item_id, false, true);
            if (empty($alt)) {
                $alt = sprintf(__('Profile picture of %s', 'buddypress'), bp_core_get_user_displayname($activities_template->activity->secondary_item_id));
            }
            break;
        default:
            $object = 'user';
            $item_id = $activities_template->activity->user_id;
            $email = $activities_template->activity->user_email;
            $link = bp_core_get_userlink($item_id, false, true);
            if (empty($alt)) {
                $alt = sprintf(__('Profile picture of %s', 'buddypress'), $activities_template->activity->display_name);
            }
            break;
    }
    /**
     * Filters the activity secondary avatar object based on current activity item component.
     *
     * This is a variable filter dependent on the component used. Possible hooks are
     * bp_get_activity_secondary_avatar_object_blog, bp_get_activity_secondary_avatar_object_group,
     * and bp_get_activity_secondary_avatar_object_user.
     *
     * @since 1.2.10
     *
     * @param string $object Component being displayed.
     */
    $object = apply_filters('bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object);
    /**
     * Filters the activity secondary avatar item ID.
     *
     * @since 1.2.10
     *
     * @param int $item_id ID for the secondary avatar item.
     */
    $item_id = apply_filters('bp_get_activity_secondary_avatar_item_id', $item_id);
//.........这里部分代码省略.........
开发者ID:divemasterza,项目名称:Checkedin,代码行数:101,代码来源:bp-activity-template.php


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