/** * 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); }
/** * Render the Avatar metabox to moderate inappropriate images. * * @since 2.0.0 * * @param WP_User|null $user The WP_User object for the user being edited. */ public function user_admin_avatar_metabox($user = null) { if (empty($user->ID)) { return; } ?> <div class="avatar"> <?php echo bp_core_fetch_avatar(array('item_id' => $user->ID, 'object' => 'user', 'type' => 'full', 'title' => $user->display_name)); ?> <?php if (bp_get_user_has_avatar($user->ID)) { $query_args = array('user_id' => $user->ID, 'action' => 'delete_avatar'); if (!empty($_REQUEST['wp_http_referer'])) { $query_args['wp_http_referer'] = urlencode(wp_unslash($_REQUEST['wp_http_referer'])); } $community_url = add_query_arg($query_args, buddypress()->members->admin->edit_profile_url); $delete_link = wp_nonce_url($community_url, 'delete_avatar'); ?> <a href="<?php echo esc_url($delete_link); ?> " title="<?php esc_attr_e('Delete Profile Photo', 'buddypress'); ?> " class="bp-xprofile-avatar-user-admin"><?php esc_html_e('Delete Profile Photo', 'buddypress'); ?> </a> <?php } // Load the Avatar UI templates if user avatar uploads are enabled and current WordPress version is supported. if (!bp_core_get_root_option('bp-disable-avatar-uploads') && bp_attachments_is_wp_version_supported()) { ?> <a href="#TB_inline?width=800px&height=400px&inlineId=bp-xprofile-avatar-editor" title="<?php esc_attr_e('Edit Profile Photo', 'buddypress'); ?> " class="thickbox bp-xprofile-avatar-user-edit"><?php esc_html_e('Edit Profile Photo', 'buddypress'); ?> </a> <div id="bp-xprofile-avatar-editor" style="display:none;"> <?php bp_attachments_get_template_part('avatars/index'); ?> </div> <?php } ?> </div> <?php }
/** * Should we use the group's cover image header. * * @since 2.4.0 * * @return bool True if the displayed user has a cover image, * False otherwise */ function bp_group_use_cover_image_header() { return (bool) bp_is_active('groups', 'cover_image') && !bp_disable_group_cover_image_uploads() && bp_attachments_is_wp_version_supported(); }
/** * Should we use the cover image header * * @since 2.4.0 * * @return bool True if the displayed user has a cover image, * False otherwise */ function bp_displayed_user_use_cover_image_header() { return (bool) bp_is_active('xprofile', 'cover_image') && !bp_disable_cover_image_uploads() && bp_attachments_is_wp_version_supported(); }