Last active
June 11, 2023 05:06
-
-
Save NafisMahmudAyon/f9f3e3461f70de8666ee3ebfb8a67dcc to your computer and use it in GitHub Desktop.
User Verification Plugin- Verification Badge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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