[WordPress] 外掛分享: Get User Custom Field Values

首頁外掛目錄 › Get User Custom Field Values
WordPress 外掛 Get User Custom Field Values 的封面圖片
90+
安裝啟用
★★★☆☆
3.7/5 分(3 則評價)
1603 天前
最後更新
問題解決
WordPress 4.6+ v3.3 上架:2011-08-07

內容簡介

此外掛提供一個強大的小工具、支援簡碼(具有簡碼建立工具)和範本標籤,可輕鬆擷取和顯示當前登入使用者或任何指定使用者的自訂欄位值。
此外掛提供類似於「Get Custom Field Values」外掛的功能,但針對使用者自訂欄位(WordPress 在另一個資料庫表中管理)。
此外掛不會協助您設定使用者自訂欄位值,也不提供列出或以其他方式管理使用者自訂欄位的介面。
WordPress 預設提供一個有用的使用者自訂欄位值列表,包括:
- first_name
- last_name
- nickname
- description
- aim
- yim
- jabber
其他外掛或自訂程式碼可增加其他使用者自訂欄位,然後您可以使用此外掛擷取這些欄位值。
連結:插件首頁、插件目錄頁面、GitHub、作者首頁
開發者文件
開發者文件可在「DEVELOPER-DOCS.md」中找到,該文件涵蓋此外掛提供的大量範本標籤、鉤子和簡碼。
以下是此外掛提供的範本標籤:
- c2c_get_current_user_custom():取得目前已登入使用者的自訂欄位。
- c2c_get_author_custom():取得目前作者的自訂欄位(在文章、頁面等的永久連結頁面或迴圈中)。
- c2c_get_user_custom():取得指定使用者的自訂欄位。
以下是此外掛提供的鉤子:
- c2c_get_current_user_custom:一種安全調用 「c2c_get_current_user_custom()」的替代方法,若外掛停用或刪除,您對此函式的呼叫將不會在網站上造成錯誤。
- c2c_get_author_custom:一種安全調用 「c2c_get_author_custom()」的替代方法,若外掛停用或刪除,您對此函式的呼叫將不會在網站上造成錯誤。
- c2c_get_user_custom:一種安全調用 「c2c_get_user_custom()」的替代方法,若外掛停用或刪除,則您對此函式的呼叫將不會在網站上造成錯誤。
- c2c_get_user_custom_field_values_shortcode:篩選器,可自訂外掛簡碼的名稱。
- c2c_get_user_custom-user_field_proxy:篩選器,可防止在未找到使用者的自訂欄位值時,代理到使用者物件欄位。
- get_user_custom_field_values/can_author_use_shortcodes:篩選器,可自訂文章作者是否能夠使用「user_custom_field」簡碼。
- get_user_custom_field_values/show_metabox:篩選器,可自訂是否顯示簡碼建立器的 Metabox。
此外掛提供的簡碼是「[user_custom_field]」,有許多參數可供設定。

外掛標籤

開發者團隊

⬇ 下載最新版 (v3.3) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Get User Custom Field Values」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin provides a powerful widget, shortcode (with shortcode builder tool), and template tags for easily retrieving and displaying custom field values for the currently logged in user or any specified user.
This plugin provides functionality similar to the Get Custom Field Values plugin, but for user custom fields (which WordPress manages in a separate database table).
This plugin does NOT help you in setting user custom field values, nor does it provide an interface to list or otherwise manage user custom fields.
The list of useful user custom field values that are provided by default in WordPress are:

first_name
last_name
nickname
description
aim
yim
jabber

It is up to other plugins or custom code to add additional user custom fields that you may then be able to retrieve with this plugin.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the numerous template tags, hooks, and shortcode provided by the plugin.
As an overview, these are the template tags provided the plugin:

c2c_get_current_user_custom() : Template tag to get custom fields for the currently logged in user.
c2c_get_author_custom() : Template tag to get custom fields for the current author (when on the permalink page for a post, page, or in a loop).
c2c_get_user_custom() : Template tag to get custom fields for a specified user.

These are the hooks provided by the plugin:

c2c_get_current_user_custom : An alternative approach to safely invoke c2c_get_current_user_custom() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
c2c_get_author_custom : An alternative approach to safely invoke c2c_get_author_custom() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
c2c_get_user_custom : An alternative approach to safely invoke c2c_get_user_custom() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
c2c_get_user_custom_field_values_shortcode : Filter to customize the name of the plugin’s shortcode.
c2c_get_user_custom-user_field_proxy : Filter to prevent proxying to user object fields if no value for the custom field was found for the user.
get_user_custom_field_values/can_author_use_shortcodes : Filter to customize if post author can make use of the ‘user_custom_field’ shortcode.
get_user_custom_field_values/show_metabox : Filter to customize if the shortcode builder metabox is shown.

The shortcode provided is [user_custom_field], which has a number of attributes to customize its behavior and output.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon