[WordPress] 外掛分享: Get Author’s Comments

首頁外掛目錄 › Get Author's Comments
10+
安裝啟用
尚無評分
6073 天前
最後更新
問題解決
WordPress 2.7+ v1.1.0 上架:2008-12-08

內容簡介

本外掛允許顯示或檢索使用者發布的評論。為了避免同音異義問題,使用者會通過名稱和電子郵件地址進行識別。

注意:獲取作者評論使用 WordPress 2.7 引入的 wp_list_comments 函數進行(x)HTML輸出。

用法:

顯示特定用戶在當前文章中的所有評論:

?>

或者,如果 piouPiouM 使用兩個不同的電子郵件地址:

?>

顯示用戶發布的所有評論:

?>

在 ID 為 9 的文章中顯示用戶發布的評論:

?>

注意:如果您在 The Loop 中使用 ppm_author_comments 或 ppm_get_author_comments 標籤,$ postID 參數將自動替換為當前文章的數字 ID。

按帖子_ID排序的最新評論:

為了顯示由 piouPiouM 發布的最後十則評論,按帖子_ID升序排列,以下代碼將顯示他們的評論日期和摘要:

says:

Comment posted on :

帶有自定義評論顯示的評論:

?>

請參閱自定義回調函數的示例,以瞭解自訂評論顯示。

顯示使用者在網站上發布的評論總數:

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Get Author's Comments」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin allows to display or retrieve comments posted by a user. In order to avoid homonyms, a user is identified by his name and email(s).
Note: Get Author’s Comments uses the function wp_list_comments introduced by WordPress 2.7 for the (x)HTML output.
Usage
Display all comments of a specific user in the current post

?>

or, if piouPiouM wrote with two different emails:

?>

Display all comments posted by a user

?>

Display comments wrote by a user in the post of ID number 9

?>

Note: If you used the tags ppm_author_comments or ppm_get_author_comments whithin The Loop, the parameter $postID will be replaced automatically by the numeric ID of the current post.
Lastest comments ordered by post_ID
To show the last ten piouPiouM’s comments sorted by post_ID in ascending order, the following will display their comment date and excerpt:

says:

  1. Comment posted on :

Comments with a custom comment display

?>

See Comments Only With A Custom Comment Display for an example of a custom callback function.
Show the total number of comments posted by a user on the site
display_name, $current_user->user_email, null, 'all=1');
printf('Hello ! %s! '
. '[ Log Out ]
'
. '%d posts and %d comments',
$current_user->user_login,
$current_user->display_name,
wp_logout_url(),
get_usernumposts($current_user->ID),
count($comments));
?>

Parameters

all
(boolean) (optional) Retrieve all comments. Default to FALSE.
number
(integer) (optional) Number of comments to return. Default to None, returns all comments.
offset
(integer) (optional) Offset from latest comment. Default to 0.
orderby
(string) (optional) Sort posts by one of various values (separated by space), including:

'comment_ID' – Sort by numeric comment ID.
'content' – Sort by content.
'date' – Sort by creation date. (Default)
'post_ID' – Sort by post ID.
'rand' – Sort in random order.
'status' – Sort by status.
'type' – Sort by type.

order
(string) (optional) Sort order, ascending or descending for the orderby parameter. Valid values:

'ASC' – Ascending (lowest to highest).
'DESC' – Descending (highest to lowest). (Default)

output
(string) (optional) How you’d like the result. Only for ppm_get_author_comments.

OBJECT – Returns an object. (Default)
ARRAY_A – Returns an associative array of field names to values.
ARRAY_N – Returns a numeric array of field values.
HTML – Returns a (x)HTML version generated by wp_list_comments.

status
(string) (optional) The comments status. Default to hold and approve. Valid values:

'hold' – Unapproved.
'approve' – Approved.
'spam' – Spam.

延伸相關外掛

文章
Filter
Mastodon