r-a-y / buddypress-followers

Follow users on your BuddyPress site. Similar to Twitter!
http://wordpress.org/plugins/buddypress-followers/
75 stars 39 forks source link

Buddypress follow plugin and buddypress 12.0.0 #125

Open teboy opened 10 months ago

teboy commented 10 months ago

Hello @ray,

I decided to test buddypress 12.0.0 beta 1 & 2 and noticed that clicking the user navigation menu for following and followers tab triggers an error. The plugin is not compatible with the upcoming buddypress 12.0.0

A resolution would be really appreciated

Thanks

r-a-y commented 10 months ago

I've merged #126 into master branch. Please give latest master branch a try to see if that fixes things.

teboy commented 10 months ago

Hello @r-a-y

I have updated the plugin but I am still getting errors this is message from my debug log file

2023-09-18T09:57:56+00:00 CRITICAL Cannot redeclare bp_follow_screen_followers() (previously declared in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/screens.php:19) in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/screens.php on line 17

2023-09-18T09:58:25+00:00 CRITICAL Cannot redeclare bp_follow_action_start() (previously declared in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/actions.php:22) in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/actions.php on line 21

Thanks

r-a-y commented 10 months ago

I cannot duplicate this problem. Can you try either renaming or deleting the buddypress-followers-master folder and downloading the latest version from here -- https://github.com/r-a-y/buddypress-followers/archive/refs/heads/master.zip ?

Or if you are able to start on a fresh, test install of BP 12 beta with the latest version of buddypress-followers, that would help as well.

teboy commented 10 months ago

Hi

For this error 2023-09-18T09:58:25+00:00 CRITICAL Cannot redeclare bp_follow_action_start() (previously declared in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/actions.php:22) in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/actions.php on line 21

I tried using gpt and it provided me with an updated code and I no longer receive this error again. To fix the error related to the actions.php file in the BuddyPress Follow plugin, you should check for the existence of functions before declaring them to avoid redeclaration issues. Here's the corrected code for the actions.php file:

`<?php /**

// Exit if accessed directly. defined( 'ABSPATH' ) || exit;

if ( ! function_exists( 'bp_follow_action_start' ) ) { /**

if ( ! function_exists( 'bp_follow_action_stop' ) ) { /**

if ( ! function_exists( 'bp_follow_my_following_feed' ) ) { /**

In this corrected code, I've added conditional checks using `if ( ! function_exists(

teboy commented 10 months ago

The only error left now in my log is

2023-09-21T12:58:02+00:00 CRITICAL Cannot redeclare bp_follow_screen_followers() (previously declared in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/screens.php:19) in /var/www/wptbox/wp-content/plugins/buddypress-followers-master/_inc/users/screens.php on line 17

mrjarbenne commented 10 months ago

Are you sure you don't have two different copies of the plugin active? The plugin from the WP repo is in a directory named buddypress-followers, while the one from Github has "-master" at the end, so manually FTP'ing the plugin wouldn't replace the older version. I would check the wp-content/plugins folder for duplicates.

teboy commented 10 months ago

@mrjarbenne im 100% sure I only have one copy. Im only using the copy from github

mrjarbenne commented 10 months ago

And the error still exists if you deactivate all your other plugins and activated a default theme? All these re-declarations make it seem like perhaps another plugin or theme has tried to integrate bp-follow functions that are getting triggered first.

teboy commented 10 months ago

Hello @r-a-y @mrjarbenne

This issue is now resolved. The problem was caused by a plugin conflict with https://wordpress.org/plugins/mark-new-posts/ Its quite strange but immediately I deactivated Mark New Post plugin there was no more error

Thanks so much for your support

r-a-y commented 10 months ago

I looked into the "Mark New Posts" plugin and the problem is with this line: https://plugins.trac.wordpress.org/browser/mark-new-posts/trunk/mark-new-posts.php#L160 .

The plugin is fetching posts on the 'pre_get_posts' hook, so this means that any plugin hooked to any main post query would run twice. I've added a clause so my code is only included once, but even with this line added, the "Mark New Posts" plugin will still break any BuddyPress page. I've replied to teboy's post on wordpress.org with some recommendations: https://wordpress.org/support/topic/buddypress-follow-conflict/#post-17069687 .

epgb101 commented 7 months ago

Thank you all for doing this - I downloaded the zip file and it worked great on BP :)

faithsly commented 5 months ago

Hello R-A-Y/Buddypress-Followers, can you read me ? There is an error am getting on my site and it's not letting users follow watch other. Please check this screenshot for the errors code and help.