Forum breadcrumbs – You are here:Asgaros Support ForumSupportFilter Profile Link
Please or Register to create posts and topics.

Filter Profile Link

Hi there,

I’m trying to filter the topic user profile link to a different profile page. I’m using:

add_filter('asgarosforum_filter_profile_link', 'modify_profile_link', 10, 2);
function modify_profile_link( $userObject, $additional_parameters = false ){

  $profileLink = 'https://theseekersforum.com/my-profile/' . $userObject->ID;
       
  return $profileLink;
}

But $userObject->ID is blank. Why isn’t $userObject actually populated with the post user? How can I get the ID of the user for the current post?

Thanks,
Jonah

Hey @jonahcoyote,

your function modify_profile_link is wrong. This functions gets the parameter $profileLink and $userObject. So you basically try to get an ID of the profile link. Please try the following code:

add_filter('asgarosforum_filter_profile_link', 'modify_profile_link', 10, 2);
function modify_profile_link( $profileLinke, $userObject ){
  $profileLink = 'https://theseekersforum.com/my-profile/' . $userObject->ID;
       
  return $profileLink;
}

You can also use my Plugin “Toolbox for Asgaros Forum” to change the URL of the profile link.

If you ever wonder how to return the favour for helping you.

Hey @qualmy91,

Thanks for the reply! That makes sense and that worked. Thanks so much!