• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Open For Discussion Link to members profile

Kitmitsu

Baby Bird
Is it possible to make clicking a user's name in WordPress comments always link to their Xenforo profile? At the moment it seems that it only links to their profile if they posted from Xenforo.

Thanks.
 

Gracie

Dogs Times Writer
@Kitmitsu
Do you already know how to do it?
I think we need edit "comments.php" in wordpress files.

It's a hook that @LPH can add; however, the demand for the feature isn't very high. I think he's trying to get things into a strong release candidate. Actually, he's waiting for another developer to make a suggestion on a database reset. I'll leave @LPH to explain.
 

dzonyloker

Baby Bird
XenWord Professional
It's a hook that @LPH can add; however, the demand for the feature isn't very high. I think he's trying to get things into a strong release candidate. Actually, he's waiting for another developer to make a suggestion on a database reset. I'll leave @LPH to explain.
thank you for info
 

Kitmitsu

Baby Bird
@Kitmitsu
Do you already know how to do it?
I think we need edit "comments.php" in wordpress files.

That's the route I ended up taking. I'm using wpdiscuz for my comment system and added this to a theme version of class.WpdiscuzWalker.php:

PHP:
$authorID = $user->ID;
$authorSlug = $user->user_login;
$authorSlug = mb_strtolower($authorSlug);

Then I swapped out "$authorName" with this:

PHP:
'<a href="' . home_url() . '/community/members/' . $authorSlug . '.' . $authorID . '/">' . $authorName . '</a>'

Very hacky but it does exactly what I wanted.
 

Gracie

Dogs Times Writer
In the legacy code, it is probably best to use XenForo_Link::buildPublicLink with canonical rather than home_url. Also, the user_nicename is what is moved over from XenForo to WordPress. I don't recall why it couldn't be user_login for certain member usernames.

The author_link is used as the hook in XenWord but I'm not sure what it would be for comment author.
 

Kitmitsu

Baby Bird
In the legacy code, it is probably best to use XenForo_Link::buildPublicLink with canonical rather than home_url. Also, the user_nicename is what is moved over from XenForo to WordPress. I don't recall why it couldn't be user_login for certain member usernames.

The author_link is used as the hook in XenWord but I'm not sure what it would be for comment author.

Yep that's a much better way of doing it. After looking into it, user_nicename sanitizes names for urls incase usernames have weird characters so it makes much more sense to use that. Added both of those changes to my own setup. Thanks!
 
Top