Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NafisMahmudAyon/f9f3e3461f70de8666ee3ebfb8a67dcc to your computer and use it in GitHub Desktop.
Save NafisMahmudAyon/f9f3e3461f70de8666ee3ebfb8a67dcc to your computer and use it in GitHub Desktop.
User Verification Plugin- Verification Badge
add_filter("the_author", "change_author");
function change_author($author)
{
global $post;
$post_auhtor = $post->post_author;
$status = get_user_meta($post_auhtor, 'user_activation_status', true);
if ($status == 1) {
$author .= " - VERIFIED.";
} else {
$author .= " - UNVERIFIED.";
}
return $author;
}
function modify_get_comment_author_defaults($author, $comment_ID, $comment)
{
global $post;
//var_dump($comment);
$comment_ID = $comment->comment_ID;
$user_ID = get_comment($comment_ID)->user_id;
$status = get_user_meta($user_ID, 'user_activation_status', true);
if ($status == 1) {
$author .= " - VERIFIED.";
} else {
$author .= " - UNVERIFIED.";
}
return $author;
}
// add the filter
add_filter("get_comment_author", "modify_get_comment_author_defaults", 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment