Filter Profile Link
Quote from jonahcoyote on April 22, 2021, 12:17 amHi 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
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
Quote from qualmy91 on April 22, 2021, 6:15 amHey @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.
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.
Quote from jonahcoyote on April 22, 2021, 5:20 pmHey @qualmy91,
Thanks for the reply! That makes sense and that worked. Thanks so much!
Hey @qualmy91,
Thanks for the reply! That makes sense and that worked. Thanks so much!