Closed ARCangelGIRL closed 5 years ago
You didn't define $getUserId
.
$getUserId
defined in my code, just didn't paste it here.
Everything works fine, user can follow and unfollow other member, just the email is not sent at all like it is if I follow from member loop.
Email is probably triggered by a hook that you're not calling.
do_action ('bp_follow_start_following');
?
Could you advice me where exactly I should place this action in above code?
It would go like this:
if ( function_exists( 'bp_follow_add_follow_button' ) ) :
if ( bp_loggedin_user_id() && bp_loggedin_user_id() != $getUserID ) {
bp_follow_add_follow_button( array(
'leader_id' => $getUserID,
'follower_id' => bp_loggedin_user_id()
) );
do_action ('bp_follow_start_following');
}
endif;
Actually I was doing the same, but all I get is the following:
Catchable fatal error: Argument 1 passed to bp_follow_notifications_add_on_follow() must be an instance of BP_Follow, string given in .../wp-content/plugins/buddypress-followers/_inc/bp-follow-notifications.php on line 95
Can it be happening because I'm using PHP version 5.6 and not 7.2 like it's suggested in Wordpress documentation?
Can it be happening because I'm using PHP version 5.6 and not 7.2 like it's suggested in Wordpress documentation?
No, but you should update to 7.2 anyway. 5.x will no longer be supported after the end of the year.
Catchable fatal error: Argument 1 passed to bp_follow_notifications_add_on_follow() must be an instance of BP_Follow, string given in .../wp-content/plugins/buddypress-followers/_inc/bp-follow-notifications.php on line 95
Sorry, my bad. You would have to pass the leader_id
and follower_id
arguments through the action. I.E. do_action ( 'bp_follow_start_following', $args );
.
However, I'm smacking my forehead for my previous suggestion because that would send an email whenever the page is loaded, not when the button is clicked. Whoops. So, you should abandon that snippet. Sorry, I was being a bone head.
🤦♂️
Yeah, that's true. Didn't thought about it, that email will be sent every time page is loaded :) I will try to find another way to fix this.
The information in this thread is incorrect. Follow hooks are automatically fired when a person follows another person. You don't need to add any do_action()
codes or whatever.
However, one important thing to note is the follow email is only sent once. If person B unfollows person A and tries to follows person A again, person A will not get a subsequent email about how person B just followed them.
I'm going to close this as this isn't a problem with the code. However, feel free to continue replying to one another.
Thanks, r-a-y, for clearing that up. I apologize for the wrong information. :-D
Hi Ray/all.. I'm so please I found this plugin on Github updated for 2023. It works brilliantly on my site but I'm tweaking the text so I can use it as a Like feature. Q: How do I edit the email text that gets sent to users in the newest plugin update that says; Subject: Userx is now following you Userx is now following your activity.
There doesn't seem to be any email/text I can edit added in the Dashboard > Emails section of WP.
Any help for novice would be very much appreciated. Ed
Hello, I followed this to add follow button in different places in the website. https://github.com/r-a-y/buddypress-followers/wiki/Add-a-follow-button-on-a-regular-WP-page Below is my code.
I use Buddypress. Follow button was added in member header and in one other page that is outside the member loop. What I would like to do - when somebody follows members, send an email. In member loop when following somebody, email is sent, but using this snippet no email were sent. I was checking around in plugin files, but can't figure it out how to do it. Could you help me with this?