Hey guys i can see users email ids used as username in recent comments widget of my site instead of anonymous can you confirm this issue and get it resolved asap thanks
anyone?
Hey Well wisher,Â
Please add this custom code into your theme functions.php
function dwqa_anonymous_comment_author_link( $comment ) {
// global $current_comment;
if( $comment->user_id <= 0 ) {
$comment->comment_author = __('Anonymous','dwqa');
}
return $comment ;
}
add_filter( 'get_comment', 'dwqa_anonymous_comment_author_link' );
This is a quickfick to make a mask for your anonymous comment
Regards
thanks for the support and code @Bighug 🙂
one thing more have you guys knowingly switched of the voting and follow feature more mobile devices of smaller screen sizes because i am unable to them lately when visiting my site by mobile
it turned all comments anonymous !!!
That’s weird. As you can see in the code, i checked author id before convert their author name to anonymous so it should be that all new comments posted by anonymous users only.
yaa i know its weird but still its happening may be because you took the global $current_comment variable but dint used it as i see its commented over there using //
i think the code should be like something i have mentioned in answer below
Any lead on this ?
ok this is what the scenario is if user is logged in then the code works else not i think was testing it late at night
Guys can you confirm this issue?
Hi Well Wisher,
Sorry for my late reply, can you provide me an admin account for further checking, i want to improve the code that i sent to you before
Hi @BigHug at the moment the only thing i can provide is the link to my site where you can see the problem here you go http://brainlubricator.com/identify-fake-fraud-company/ check out the comments section there
as i already informed you above that the code works when logged in as admin but fails when the comment is made using the form without logging may be because you are checking the user_id eg 1 for admin 2 for author etc i and <=0 makes anonymous but using the comment_id may resolve this issue
I saw the problem. Here are my improvement for this code. It will only turn the comment author to anonymous for Question Answer Post type:
function dwqa_anonymous_comment_author_link( $comment ) {
// global $current_comment;
$comment_post_parent_type = get_post_type( $comment->comment_post_ID );
if( $comment->user_id <= 0 && ( $comment_post_parent_type == 'dwqa-question' || $comment_post_parent_type == 'dwqa-answer' ) ) {
$comment->comment_author = __('Anonymous','dwqa');
}
return $comment ;
}
add_filter( 'get_comment', 'dwqa_anonymous_comment_author_link' );
wait for a moment let me check it ,will inform you in a minute or two
nope nothing changed its still saying anonymous
@bighus i want you to have a look here i was thinking to implement these to achieve the purpose http://codex.wordpress.org/Function_Reference/comment_author
Displays the comment author name; that is, the one supplied by the commenter. If no name is provided (and “User must fill out name and email” is not enabled under Discussion Options), WordPress will assign “Anonymous” as comment author.
Use get_comment_author() to retrieve the value.
http://codex.wordpress.org/Function_Reference/comment_author_email
http://codex.wordpress.org/Function_Reference/comment_author_link
http://codex.wordpress.org/Function_Reference/get_comment_ID
http://codex.wordpress.org/Function_Reference/comment_ID
This is how wordpress do its anonymous comment thing i thought the answer to this problem may be found here i tried doing the stuff but achieved no success
Hope this helps
Hi @bighug the issue is still there even after the latest update and there are more problems like answer page is breaking scripts and answer form is not working
Hi Well !
Apologies for the delay in replying to you.
The latest version of the DW Q&A plugin has already been released with bug fixes. Could you kindly upgrade it and let us know if you face with any problems.
Yes, i have updated to the latest version few days back and it has resolved the issue @Bighug thanks for the great work 🙂
i am just curious bout what made the difference(only if you have time to give an small idea) ?
Please login or Register to submit your answer