Notifications
Clear all

'wpdiscuz_profile_url' suport for return false

3 Posts
2 Users
0 Likes
926 Views
(@drlightman)
Active Member
Joined: 5 years ago
Posts: 13
Topic starter  

Could be possibile that returning false with that filter wpdiscuz_profile_url we avoid the linking of the username totally at the beginning of the comment form?

Thanks


   
Quote
Elvina
(@elvina)
Support
Joined: 5 years ago
Posts: 1403
 

Hi @drlightman,

There are two following options to hide the link of the username:

1. You can use the following CSS code:

div#wc_show_hide_loggedin_username a:first-child {
color: currentColor !important;
cursor: not-allowed !important;
text-decoration: none !important;
pointer-events: none !important;
}

The CSS code should be added in the Dashboard > Comments > Settings > Styling > "Custom CSS code" textarea. 

2. or you can use the following JS code:

jQuery( "#wc_show_hide_loggedin_username a:first-child " ).removeAttr("href");

The js code you should add in your active them's js files.

In any case, please don't forget to delete all caches and press Ctrl+F5 (twice) on the frontend before checking to reload the updated CSS/JS files. 


   
ReplyQuote
(@drlightman)
Active Member
Joined: 5 years ago
Posts: 13
Topic starter  

Hello,

thank you for the suggestion @elvina

In my case I was asked to make the modification urgently so I had to mod the code myself, as follows if interested:

replaced:

echo $wpdiscuz->optionsSerialized->phrases['wc_logged_in_as'] . ' <a href="' . $user_url . '">' . $wpdiscuz->helper->getCurrentUserDisplayName($currentUser) . '</a> | ' . $logout;

with:

if (false === $user_url) {
echo $wpdiscuz->optionsSerialized->phrases['wc_logged_in_as'] . ' <strong>' . $wpdiscuz->helper->getCurrentUserDisplayName($currentUser) . '</strong> | ' . $logout;
}
else {
echo $wpdiscuz->optionsSerialized->phrases['wc_logged_in_as'] . ' <a href="' . $user_url . '">' . $wpdiscuz->helper->getCurrentUserDisplayName($currentUser) . '</a> | ' . $logout;
}

And added a filter to 'wpdiscuz_profile_url' in functions.php returning false.

The reason I was asked to do so is that for users who have not written any articles yet - and for commenters, they are the majority - the url leads to a 404 page, that may be confusing and I didn't know any other kind of working url to replace it with.


   
ReplyQuote
Share:
Scroll to top