Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.
I have tried implementing this example provided for changing the displayed name for a comment:
https://wpdiscuz.com/docs/codex/filters/wpdiscuz_comment_author/
I changed the code to remove the if statement:
add_filter("wpdiscuz_comment_author", function ($authorName, $comment) { $authorName = "Boss"; return $authorName; }, 10, 2);
However this still does not change any displayed author names:
I added the "wpdiscuz_after_comment_author" filter and that works perfectly. Please help!
Hi @serveracademy,
Please navigate to Dashboard > wpDiscuz > Settings > General Settings tab, and delete the wpDiscuz caches using the "
Also, don't forget to press Ctrl+F5 (twice) on the frontend before checking.
EDIT: DISREGARD THIS REPLY AND SEE ABOVE SOLUTION FOR PURGING CACHE
After inspecting the plugin code, I found the filter is ONLY firing for comment replies:
I believe this filter should be applied to base comments as well. After reading this documentation linked below I decided to edit the template and add support for the filter myself.
For anyone else following behind me, this documentation is a bit outdated as well because I could not locate the CSS file at '/wpdiscuz/assets/css/wpdiscuz.css', but thankfully I did not need it.
https://wpdiscuz.com/docs/wpdiscuz-documentation/customization/custom-template-and-style/
I copied 'class.WpdiscuzWalker.php' into my child theme folder (/wp-content/themes/mytheme/wpdiscuz/', and around line 254 I added the following code:
$uNameClasses = apply_filters("wpdiscuz_username_classes", ""); $user["authorNameHtml"] = '<div class="wpd-comment-author" style="padding: 0px;">' . apply_filters("wpdiscuz_comment_author", $user["user"]->data->display_name, $comment) . '</div>'; $user["authorNameHtml"] .= apply_filters("wpdiscuz_after_comment_author", "", $comment, $user["user"]);
Now the author name I configured in the filtered function is displaying as desired. Again, I believe this should be included by default and I believe this is a bug.