boonebgorges / bp-social-media-profiles

Customize and streamline the display of BuddyPress profile fields related to other social media sites
21 stars 7 forks source link

User Notice: bp_setup_current_user was called incorrectly #20

Closed twelch555 closed 7 years ago

twelch555 commented 7 years ago

Hi, love the plugin, it does exactly what I need and seems to be working in all respects.

I am in development stages and rolling with debug on and I'm getting the follow error:


User Notice: bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). === Trace:

6 wp-content/plugins/bp-social-media-profiles-master/bp-social-media-profiles.php(50): is_super_admin()

7 wp-content/plugins/bp-social-media-profiles-master/bp-social-media-profiles.php(545): BP_Social_Media_Profiles->__construct()

8 [internal function]: bp_smp_load_component('')

9 wp-includes/plugin.php(524): call_user_func_array('bp_smp_load_com...', Array)

10 wp-content/plugins/buddypress/bp-core/bp-core-dependency.php(305): do_action('bp_loaded') #11 [internal function]: bp_loaded('')

12 wp-includes/plugin.php(524): call_user_func_array('bp_loaded', Array)

13 wp-settings.php(295): do_action('plugins_loaded')

14 wp-config.php(244): require_once('w...')

15 wp-load.php(39): require_once('w...')

16 wp-admin/admin.php(31): require_once('w...')

17 wp-admin/network/admin.php(13): require_once('w...')

18 wp-admin/network/settings.php(11): require_once('w...')

19 {main}

=== Please see Debugging in WordPress for more information. (This message was added in version 1.7.) wp-includes/functions.php 3996


All indications on the blogs and forums is that the? notice is suppressed when debug is off and it probably is nothing to work about. But I have seen a couple of comments about potential Role/capabilities weirdness and I do need to run Advanced Access Manager on the site and am concerned there may be issues.

I understand that is not the most current and high priority thing on your plate likely. But I have a quick question, will the plugin function properly if loaded later in action order, say on Init?

Thanks

boonebgorges commented 7 years ago

Hi @twelch555 - Thanks for the ticket. You're correct that the notice will be suppressed when debug mode is disabled. In fact, due to some changes in WP, BuddyPress will no longer show this notice in future versions: https://buddypress.trac.wordpress.org/ticket/7305

Accessing the current user info before 'init' never posed any direct risk in BuddyPress, though it's possible that it could cause problems in certain corner cases related to bbPress. I'm afraid I don't have any details on hand about how that might work. But I don't have any reason to think that your setup will cause any problems with the current plugin, so you should be safe to ignore the notice for now, and see it disappear soon when WP and BP are updated.