Adding the follow button to user posts/ images /other places on the site – UserPro Forums https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/feed/ Sat, 04 May 2024 14:23:02 +0000 https://bbpress.org/?v=2.6.2 en-US https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37904 <![CDATA[Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37904 Mon, 19 May 2014 18:21:44 +0000 jharford I’d like to add the ‘view user profile ‘ , and ‘ Follow ‘ buttons to other areas of my site.
Thanks

sorry for duplicate post under test account

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37906 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37906 Mon, 19 May 2014 18:53:56 +0000 jharford Also , how to use the ‘heart’ like on other pages. Basically when someone views an image, I want the heart to be on that post page also , not only in the rollover.

Thanks!

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37925 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37925 Tue, 20 May 2014 10:11:06 +0000 kabadabra For follow buttons can do something like

<?php echo $userpro_social->follow_text($user_id_here_you_want_to_follow, get_current_user_id()); ?>

follow_text(‘User id that you want to follow’, ‘Your user id’)

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37926 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37926 Tue, 20 May 2014 10:15:07 +0000 jharford Thanks Kabadabra,
That’s useful but I need the code to do this on single pages dynamically. Do you know a way I can do this on single posts using the author name.

Thanks

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37927 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37927 Tue, 20 May 2014 10:28:36 +0000 kabadabra For you posts/pages get the author id by using something like

$author_id = the_author_ID();

Then for the follow button you can do

echo $userpro_social->follow_text($author_id, get_current_user_id());

This will allow users to follow the author of the post/page.

UserPro uses proper WordPress structure so the normal WordPress codex functions work as normal.

WordPress info on Author ID: http://codex.wordpress.org/Function_Reference/the_author_ID

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37928 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37928 Tue, 20 May 2014 10:43:05 +0000 jharford Thanks for your help so far!,
Author ID gets the ID, let’s say poster is ID 8 ,
Does userpro require that ID ? or the actual name of the user.

I paste this inside the single.php

<?php echo $author_id = the_author_ID(); ?>
<?php echo $userpro_social->follow_text($author_id, get_current_user_id()); ?>

but when I click follow it adds a blank follower to my follow list , but not the right one, then removes it when I refresh.

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37931 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37931 Tue, 20 May 2014 10:57:18 +0000 kabadabra Change

<?php echo $author_id = get_the_author_ID(); ?>

to just

<?php $author_id = get_the_author_ID(); ?>

We are setting a variable here, not printing out the $author_id.

You may also want to add in

This will prevent the follow button to be displayed if you are logged in and it’s your own post as well.

so you full code would be:

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37933 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37933 Tue, 20 May 2014 11:09:51 +0000 jharford I feel like we are almost there. 🙂
I added that code, however the user does not get added to my follow list. I will keep trying things.

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37935 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37935 Tue, 20 May 2014 11:24:15 +0000 kabadabra Cool…

sorry please change

$author_id = the_author_ID();

to

$author_id = get_the_author_ID();

Made a mistake with the author ID retrieval method

]]>
https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37937 <![CDATA[Reply To: Adding the follow button to user posts/ images /other places on the site]]> https://forum.userproplugin.com/forums/topic/adding-the-follow-button-to-user-posts-images-other-places-on-the-site-2/#post-37937 Tue, 20 May 2014 11:38:06 +0000 jharford Thanks! This works now. It’s perfect.
Now to figure out the other stuff. This is a great addition though, makes the site much more usable.
Thanks again

]]>