User profile page to display a different page
Hi Anspress team,
I’m using a plugin to manage user subscriptions and profiles. It works great with Anspress as expected ;). However, I would like to be directed to the plugin user profile page as opposed to the Anspress profile page. Is it possible? So basically, when I’m on the user page in Anspress and I click on profile, I would like to call a different user profile page than the one defaulted by Anspress.
Thank you guys
function my_ap_user_link_override($link, $user_id){ global $userpro; return $userpro->permalink($user_id); } add_filter('ap_user_link', 'my_ap_user_link_override', 10, 2);
Add this code to your theme function.php
I have updated the code. Try now and let me know.
I think we are pretty close. The user questions are back in, but when I click on the user thumbnail to get to his/her profile, it raises a “error 404” page. When I click on the question link, I can see the following: Warning: Missing argument 2 for my_ap_user_link_override() in /home/sapsul5/public_html/wp-content/themes/jobify/functions.php on line 853
Any thoughts Rahul?
I just updated the code. yesterday I replied from a mobile device so did not ched code properly. Now new code should work.
Thank Rahul, it seems to work like a charm!!! You’re good and always there to help!!! Much appreciated…… Is there a link to donate, I can’t seem to find it
Thanks for your kindness. Here is link https://www.paypal.com/cgi-bin/[email protected]&cmd=_xclick&item_name=Donation%20to%20AnsPress%20development
I dont knw how to deals why my other ansPress menu. I tried many times to add them to my menu but not responding. No User, Reputation, Ask menu @Rahul
Is there any php error in your server log ?
Yes its possible, read this article: How to disable AnsPress profile.
Cheers.
Thank you Rahul…. But disabling Anspress profile, will I still beable to have users collecting Rep points?
Why not, simply go to anspress option and then “users” tab check “Disable reputation for user” and save it.
Actually Rahul I want to do the opposit…. Disabling anspress profile but keeping the rep points system
Yes, disabling user profile will not effect reputation until you disable reputation 🙂
Thank you Rahul. I tried your code to disabling profile and it works. When I click the user picture/name next to the question/answer it doesn’t direct me to Anspress profile page anymore. It’s actually bringing me to my blog page. However, what I would like to do it’s the following:
When I click on the user name/picture in Anspress, I should be going on the user profile page from the user plugin I have installed (Userpro).
Is there anyway to accomplish this?
what is the user url of userpro ?
It uses a shortcode in Userpro profile page ([userpro template=view])
Can I private message you the link of one of the user profile page as an example?
Please ask userpro support about the function to get the link to userpro user profile, then I will give you a filter to override user link.
Hi Rahul, this is what I’m getting from them:
Getting the permalink (profile URL) for a user:
You can use the API function permalink() to get the permalink/profile URL for any user. This helps you integrate/replace author link in your theme with profile URL, or change author link in comments to profile URL.
You must define a global If you’re going to use any API function like this:
“”
Now, lets get the permalink for user ID 22
permalink(22); ?>
“”permalink(22); ?>
Very simple. This way you can generate profile permalink automatically for your users dynamically by using the above API method.
Unfortunately, I can’t paste PHP code here, it keeps disappearing 🙁
So Rahul, what is the filter to override user link? Cause it seems that tI only have to do the following from Userpro to get the user URL:
Declare global:
global $userpro;
PHP function:
$profile_url = $userpro->permalink( get_current_user_id() )
Thank you Rahul,
However, when I add the above code to my theme function.php, the question came all empty, except that I still have the ‘ask question’ button and the different filter. Also, I noticed that my wp admin bar on top of the screen disappeared and becomes all white.
any clue? Am I missing something? apart from the code you pasted above, do I have to add something else in function.php?
This is what Userpro support provided to integrate with any other plugins. I think this could be useful for a lot of Anspress users:
http://userproplugin.com/userpro/integration-guide/