微慕WordPress小程序商城
  • 微慕官网
  • 微慕产品
  • 增值服务
  • 问答社区
  • 安装文档
  • 联系客服
登录

wordpress插件之WP User Avatar | User Profile Picture

Wordpress插件 2020-07-23 0 315

WP User Avatar | User Profile Picture的作者是ProfilePress,目前有400,000+个有效安装。已经Tested with 5.4.1版本的wordpress。
Description

WordPress currently only allows you to use custom avatars that are uploaded through Gravatar. WP User Avatar enables you to use any photo uploaded into your Media Library as an avatar. This means you use the same uploader and library as your posts. No extra folders or image editing functions are necessary.

WP User Avatar also lets you:

Upload your own Default Avatar in your WP User Avatar settings.
Show the user’s Gravatar avatar or Default Avatar if the user doesn’t have a WP User Avatar image.
Disable Gravatar avatars and use only local avatars.
Use the [avatar_upload] shortcode to add a standalone uploader to a front page or widget. This uploader is only visible to logged-in users.
Use the [avatar] shortcode in your posts. These shortcodes will work with any theme, whether it has avatar support or not.
Allow Contributors and Subscribers to upload their own avatars.
Limit upload file size and image dimensions for Contributors and Subscribers.
ADVANCED SETTINGS

Visit WP User Avatar for more information and documentation.

ADD WP USER AVATAR TO YOUR OWN PROFILE EDIT PAGE

You can use the [avatar_upload] shortcode to add a standalone uploader to any page. It’s best to use this uploader by itself and without other profile fields.

If you’re building your own profile edit page with other fields, WP User Avatar is automatically added to the show_user_profile and edit_user_profile hooks. If you’d rather have WP User Avatar in its own section, you could add another hook:

do_action('edit_user_avatar', $current_user);

Then, to add WP User Avatar to that hook and remove it from the other hooks outside of the administration panel, you would add this code to the functions.php file of your theme:

function my_avatar_filter() {
// Remove from show_user_profile hook
remove_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
remove_action('show_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));

// Remove from edit_user_profile hook
remove_action('edit_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
remove_action('edit_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));

// Add to edit_user_avatar hook
add_action('edit_user_avatar', array('wp_user_avatar', 'wpua_action_show_user_profile'));
add_action('edit_user_avatar', array('wp_user_avatar', 'wpua_media_upload_scripts'));
}

// Loads only outside of administration panel
if(!is_admin()) {
add_action('init','my_avatar_filter');
}

HTML WRAPPER

You can change the HTML wrapper of the WP User Avatar section by using the functions wpua_before_avatar and wpua_after_avatar. By default, the avatar code is structured like this:

Avatar


Original Size


Thumbnail

To strip out the div container and h3 heading, you would add the following filters to the functions.php file in your theme:

remove_action('wpua_before_avatar', 'wpua_do_before_avatar');
remove_action('wpua_after_avatar', 'wpua_do_after_avatar');

To add your own wrapper, you could create something like this:

function my_before_avatar() {
echo '

';
}
add_action('wpua_before_avatar', 'my_before_avatar');

function my_after_avatar() {
echo '

';
}
add_action('wpua_after_avatar', 'my_after_avatar');

This would output:


Original Size


Thumbnail

author-imageauthor-photoavatargravataruser profilewordpress小程序微慕小程序
上一篇 wordpress插件之Cookie Notice for GDPR & CCPA
下一篇 wordpress插件之Yet Another Related Posts Plugin (YARPP)

相关文章

【开源版Free】微慕WordPress小程序开源版插件及小程序源码

【开源版Free】微慕WordPress小程序开源版插件及小程序源码

微慕插件 2022-04-18 42.4K 免费
wordpress插件之Optimus – WordPress Image Optimizer

wordpress插件之Optimus – WordPress Image Optimizer

Wordpress插件 2020-08-30 488
wordpress插件之SVG Support

wordpress插件之SVG Support

Wordpress插件 2020-08-30 562
wordpress插件之WooCommerce Multilingual – run WooCommerce with WPML

wordpress插件之WooCommerce Multilingual – run WooCommerce with WPML

Wordpress插件 2020-08-30 507
联系客服阿里云优惠券腾讯云优惠券
标签
admin analytics backup cache contact form contact form 7 database ecommerce editor elementor email facebook forms gallery GDPR google google analytics gutenberg image images login menu navigation page page builder pages performance post posts responsive security seo shortcode sitemap slider smtp social media spam theme twitter widget widgets woocommerce wordpress小程序 微慕小程序

Copyright © 2021 微慕小程序 - All rights reserved | 湘ICP备17019343号 |

  • 首页
  • 分类
  • 客服
  • 我的
  • 顶部