前言介紹
- 這款 WordPress 外掛「User Avatar – Reloaded」是 2021-05-27 上架。
- 目前有 1000 個安裝啟用數。
- 上一次更新是 2023-09-14,距離現在已有 598 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 4.0 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
- 有 2 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
avatar | gravatar | author-image | author-photo | user profile |
內容簡介
WordPress 目前只允許透過 Gravatar 上傳自訂頭像。 WP User Avatar 可讓您使用任何上傳到您的媒體庫中的照片作為頭像,這意味著您可以使用相同的上傳工具和庫作為您的文章,而不需要額外的資料夾或圖像編輯功能。
WP User Avatar 還提供以下功能:
在您的 WP User Avatar 設定中上傳您自己的預設頭像。
如果使用者沒有 WP User Avatar 圖像,則顯示使用者的Gravatar頭像或預設頭像。
禁用Gravatar頭像,僅使用本地頭像。
使用[avatar_upload]shortcode將獨立的上傳工具加入到前台頁面或小工具中,此上傳工具僅對已登錄的使用者可見。
在您的文章中使用[avatar]shortcode。這些短碼將與任何主題一起使用,無論是否支援頭像。
允許貢獻者和訂閱者上傳自己的頭像。
限制貢獻者和訂閱者的上傳檔案大小和圖像尺寸。
將 WP USER AVATAR 加入您的個人檔案編輯頁面
您可以使用 [avatar_upload] shortcode 將獨立的上傳工具加入到任何頁面。最好只使用此上傳工具並避免混用其他個人檔案編輯欄位。
如果您正在建立包含其他欄位的個人檔案編輯頁面,WP User Avatar 會自動添加到 show_user_profile 和 edit_user_profile 鉤子中。如果您希望 WP User Avatar 在它自己的區段中,您可以添加另一個鉤子:
do_action('edit_user_avatar', $current_user);
然後,要將 WP User Avatar 添加到該鉤子中並將其從管理面板外的其他鉤子中刪除,您需要將以下代碼添加到您的佈景主題的 functions.php 檔案中:
HTMLWRAPPER
您可以使用函數 wpua_before_avatar 和 wpua_after_avatar 更改 WP User Avatar 區段的 HTML。預設情況下,頭像程式碼的結構如下:
Avatar
原始尺寸
縮圖
如果要刪除 div 容器和 h3 標題,則需在佈景主題的 functions.php 文件中添加以下篩濾器:
remove_action('wpua_before_avatar', 'wpua_do_before_avatar');
remove_action('wpua_after_avatar', 'wpua_do_after_avatar');
?>
要添加自己的包裝器,可以創建如下所示的代碼:
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');
?>
原文外掛簡介
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.
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:
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:
To add your own wrapper, you could create something like this:
';
}
add_action('wpua_before_avatar', 'my_before_avatar');
function my_after_avatar() {
echo '