| 开发者 |
wpmakedev
iamprazol |
|---|---|
| 更新时间 | 2026年9月10日 15:21 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv3 or later |
| 版权网址: | 版权信息 |
[wpmake_advance_user_avatar_upload] renders the full upload form on any page[wpmake_advance_user_avatar] outputs the current user's avatar[wpmake_advance_user_avatar_upload] to any page, or insert the Advanced User Avatar Gutenberg block. Users can also set their picture at Users > Profile without any placement at all.Nothing, unless you opt in. On activation you are asked once whether to share usage data. If you skip that screen, or never answer it, the plugin sends nothing at all and every feature works exactly the same — none of it is gated on opting in. If you do opt in, the following is shared with WPMake through Freemius:
add_filter( 'wpmake_advance_user_avatar_enable_freemius', '__return_false' );
The notice appears once the plugin has been active for a week, on the Dashboard and the plugin's own screen only, and only for administrators once at least one avatar has been uploaded. "Don't ask again" removes it for good, and each administrator answers for themselves. To switch it off in code for everyone — useful on client sites — drop this in a plugin or your theme's functions.php:
add_filter( 'wpmake_advance_user_avatar_show_review_notice', '__return_false' );
Add the shortcode [wpmake_advance_user_avatar_upload] to any page, or insert the Advanced User Avatar block in the block editor. Both render the full upload form, with cropping and webcam capture built in. Users can also set their picture at Users > Profile without you placing anything at all, and WooCommerce stores get an upload field on the Account Details page automatically.
Enable the WooCommerce integration in settings. The customer's avatar then appears on the My Account dashboard and an upload field is added to the Account Details page. No template editing or shortcode placement is required for the standard WooCommerce account pages.
Yes. That is the point of the plugin. Customers upload a photo directly from their device or take one with their webcam. No Gravatar account, no external sign-up, no email hashing.
Activate the plugin and let each person upload their own photo. Once someone has one, WordPress serves it everywhere it would otherwise call Gravatar — comments, author boxes, the admin bar, the Users list, the block editor and the REST API — and nothing at all is sent to Gravatar for that user, not even a hashed email address. Anyone who has not uploaded a picture still falls back to your usual default avatar.
Yes, when "Capture Picture" is switched on in settings. The browser camera opens inside the upload form, the shot is cropped the same way an uploaded file is, and nothing is written until the user saves.
Each photo is kept in your own uploads directory and served from your own domain. The plugin makes no external requests to Gravatar or any other third-party service, so no customer data leaves your site to fetch profile images. That is also what makes it straightforward under GDPR.
Yes, optionally. When the BuddyPress integration is enabled, Advanced User Avatar takes over the avatar upload flow on member profile pages, giving members the same crop and webcam tools used elsewhere on the site. Avatars also display on the member directory.
Yes. The WooCommerce integration is compatible with Bricks Builder and inserts the avatar uploader and viewer without conflicting with the builder's template rendering.
The plugin works with any theme that follows WordPress and WooCommerce template standards. It has been tested with Flatsome, Astra, Storefront, and Hello Elementor. Themes that heavily override the WooCommerce My Account templates may need minor adjustments.
Yes. From Users > Users Avatar, the admin chooses which of JPG, PNG, GIF and WEBP are accepted and sets the maximum upload size. Both limits are enforced on the server, and invalid uploads are rejected with a clear error message so the customer knows what to fix.
An avatar is network-wide: a user uploads once and the same picture appears on every site in the network they belong to. The plugin records which site the image was uploaded to and reads it from there, so the same avatar resolves correctly everywhere. Managing other people's avatars is limited to super administrators. WordPress only lets a user edit another user's account if they have network-level user permissions, and because avatars are network-wide, letting a single site's administrator change one would change how that person appears on sites they have no rights over. The bulk avatar manager is therefore hidden for administrators without network user permissions; every user can still set their own avatar from their profile or the front-end uploader. Uploads stay on the site they were made on, in that site's own uploads directory. If you switch on the Advanced deletion setting, each site answers for itself when the plugin is deleted -- a site that left it off keeps its avatars even if a sibling site opted in.
Yes. The Manage Avatars tab on the Users > Users Avatar screen lists every user with their current picture, searchable and sortable, with Change and Remove on each row. Individual users can also be edited from Users > Profile.
Yes, and no !important is needed. Every size, shape and colour is read from a CSS custom property on the widget's container, so one rule in Appearance > Customize > Additional CSS is enough:
.wpmake-advance-user-avatar-container { --wpmake-aua-avatar-size: 150px; /* avatar width/height */ --wpmake-aua-avatar-radius: 50%; /* round the avatar */ --wpmake-aua-width: 100%; /* container box */ --wpmake-aua-height: auto; --wpmake-aua-padding: 0; --wpmake-aua-btn-primary-bg: #2f7d32; /* Upload file button */ --wpmake-aua-btn-primary-bg-hover: #27682a; --wpmake-aua-btn-padding: 6px 12px; --wpmake-aua-btn-font-size: 13px; --wpmake-aua-btn-radius: 999px; }
The remaining properties follow the same naming: --wpmake-aua-align, --wpmake-aua-avatar-spacing, --wpmake-aua-btn-border-width, --wpmake-aua-btn-primary-color, --wpmake-aua-btn-capture-color, --wpmake-aua-btn-capture-color-hover, --wpmake-aua-btn-remove-border, --wpmake-aua-btn-remove-border-hover, --wpmake-aua-btn-remove-color and --wpmake-aua-btn-remove-bg-hover.
Yes. Both shortcodes accept attributes: size (avatar width/height in px), radius (avatar corner radius, e.g. 50%), and class (extra class names on the container, for your own CSS). The uploader also accepts upload_text, remove_text and capture_text for the button labels.
[wpmake_advance_user_avatar size="150" radius="50%"]
[wpmake_advance_user_avatar_upload size="120" class="my-profile-avatar" upload_text="Choose a photo"]
Yes. Copy the template you want to change out of wp-content/plugins/wpmake-advance-user-avatar/templates/ into wp-content/themes/your-theme/wpmake-advance-user-avatar/, keeping the file name, and edit your copy. The theme copy is used instead of the plugin's and survives plugin updates.
There are also action hooks for adding markup without replacing a template: wpmake_advance_user_avatar_before_avatar, wpmake_advance_user_avatar_after_avatar, wpmake_advance_user_avatar_before_uploader, wpmake_advance_user_avatar_after_uploader, wpmake_advance_user_avatar_before_upload_buttons and wpmake_advance_user_avatar_after_upload_buttons. Each receives the resolved shortcode attributes.
Yes. Once a user uploads a custom avatar, it appears inside the Better Messages chat interface in place of the default Gravatar. No extra configuration is required.
Yes. When the WP-Members integration is enabled, the avatar uploader is added to the WP-Members profile form, so members set their picture on the same form they use for the rest of their details. No template editing is required.
Use the avatar shortcode [wpmake_advance_user_avatar] to output the current user's avatar anywhere shortcodes are supported, including widgets, sidebars and page builders.
Yes. Three functions do the work, and every avatar change in the plugin goes through them:
wpmake_aua_set_user_avatar( int $user_id, int $attachment_id ) : bool
wpmake_aua_remove_user_avatar( int $user_id ) : bool
wpmake_aua_current_user_can_edit_avatar( int $user_id ) : bool
Setting an avatar checks that the user exists and that the attachment exists and is an image. The same attachment may be used by any number of users, and removing an avatar never deletes the file — so an image you picked from the Media Library stays in the Media Library.
The capability function is the one to call before accepting a change from a request. It returns true when the target is the current user — everybody owns their own avatar, whatever else they can do — or when the current user can edit_user for that person. The two setter functions deliberately do not check capabilities themselves, so code running without a current user, such as an importer or a WP-CLI command, can still set an avatar.
Two actions fire after every change, each passed the user ID and the attachment ID:
do_action( 'wpmake_aua_avatar_set', $user_id, $attachment_id );
do_action( 'wpmake_aua_avatar_removed', $user_id, $attachment_id );
wpmake_aua_get_avatar_url( int $user_id, int $size ) returns the URL of a user's uploaded avatar at the size you ask for, or an empty string if they have not set one.
wpmake_advance_user_avatar_shortcode_atts — the resolved attributes for either shortcode, with the shortcode tag as the second argumentwpmake_advance_user_avatar_template_directory — the theme sub-directory templates are looked up in, wpmake-advance-user-avatar by defaultwpmake_advance_user_avatar_locate_template — the resolved absolute path of a template, with the file name as the second argumentwpmake_advance_user_avatar_upload_url — the directory avatars are stored inwpmake_aua_avatar_subsizes — the extra image sizes generated for avatar uploadspre_get_avatar_data — WordPress's own filter, which is where this plugin supplies the avatar; use it to override the plugin entirelywpmake_advance_user_avatar_show_review_notice — return false to switch the review request off for everyone on the sitewpmake_advance_user_avatar_enable_freemius — return false to keep the usage-tracking SDK dormant, so no opt-in screen is ever shownwpmake_advance_user_avatar_promoted_products — the plugins advertised in the settings sidebar; return an empty array to remove the cardwpmake_advance_user_avatar_newsletter_endpoint — the email service endpoint the welcome screen's opt-in posts towpmake_aua_fs_loaded — action, fired once the Freemius instance exists, with the instance as its argumentwpmake_advance_user_avatar_show_review_notice filter, to switch the review request off for everyone on a site.wpmake_advance_user_avatar_enable_freemius filter to keep the tracking SDK dormant, and a wpmake_aua_fs_loaded action.wpmake_advance_user_avatar_promoted_products filter for the plugins advertised in the settings sidebar.wpmake_advance_user_avatar_newsletter_endpoint filter for the welcome screen's opt-in endpoint.wpmake_aua_set_user_avatar(), wpmake_aua_remove_user_avatar() and wpmake_aua_current_user_can_edit_avatar(). See the FAQ.wpmake_aua_avatar_set and wpmake_aua_avatar_removed, each passed the user ID and the attachment ID.pre_get_avatar_data filter, at priority 99, instead of get_avatar.wpmake_aua_avatar_subsizes filter for the extra image sizes generated on upload.wpmake_advance_user_avatar_upload_set_avatar assigns an existing attachment as an avatar.wpmake_advance_user_avatar_upload_url filter, so a relocated upload folder is cleaned up too.review_notice_content() was unprefixed in the global namespace. Renamed to wpmake_aua_review_notice_content().phpcs.xml, so composer phpcs and composer phpcbf run with no arguments. PHPCS also runs in CI now.grunt css no longer rewrites the bundled third-party stylesheets.
Developer note -- why this is 2.0.0: two public functions have been removed, so the version is a major one. wpmake_advance_user_avatar_replace_gravatar_image() and wpmake_advance_user_avatar_build_avatar_html() are gone. WordPress now builds the avatar markup itself, including class merging and srcset. If you replaced either function, that override no longer runs -- filter pre_get_avatar_data (this plugin hooks it at priority 99, so use a later one to override it), or the new wpmake_aua_avatar_subsizes filter for the generated sizes.@version 2.0.0. If you copied either into your theme, compare your copy against the new one -- the uploader template gained the optional Media Library button.
1.3.0 - 29-08-2026
yourtheme/wpmake-advance-user-avatar/, then yourtheme/, then the shipped copy, so customised markup survives an update. The theme sub-directory and the resolved path are both filterable.size, radius and class on either, plus upload_text, remove_text and capture_text on the uploader, so a single placement can differ from the site-wide styling. The attributes were previously parsed and discarded.!important needed.get_avatar filter called remove_all_filters( 'get_avatar' ) and re-added only itself, discarding every other callback on the hook for the rest of the request -- other plugins' filters, and the site owner's own snippets, silently stopped working. Replaced with a re-entrancy guard that gives the same protection without touching anyone else's filters.!important from .avatar-50, .avatar-100 and .avatar-150. get_avatar() already emits matching width and height attributes, so it only served to stop the theme, and the site owner, from resizing those avatars.wp_check_filetype_and_ext() instead of trusting the extension on the supplied filename.WP_Image_Editor and preserves the source format.bp-disable-avatar-uploads option is only written when BuddyPress is actually installed.wp_mkdir_p() instead of a mkdir( 0777 ) attempted on every request.wp_get_attachment_thumb_url() replaced with wp_get_attachment_image_url() (deprecated since WordPress 6.0).date_i18n() replaced with wp_date() (deprecated since WordPress 5.3).upload_dir filter was never properly removed after file upload due to an anonymous closure reference mismatch.size_format() was called on an already-formatted string, producing incorrect upload limit messages.remove_avatar() no longer runs when no user is logged in.maybe_later dismiss action now uses a transient; dismiss_notice() now includes a capability check.WPMAKE_ADVANCE_USER_AVATAR_TEMPLATE_PATH constant definition.join() replaced with implode() throughout (PHPCS standard).$args['class'] now guarded with empty() to prevent PHP notices on non-standard calls.