[buddypress-trac] [BuddyPress Trac] #8177: Admin Issue : Trying to get property ‘show_avatars’ of non-object
buddypress-trac
noreply at wordpress.org
Mon Jan 13 23:20:56 UTC 2020
#8177: Admin Issue : Trying to get property ‘show_avatars’ of non-object
-------------------------------+------------------------------
Reporter: mangeshnadekar | Owner: (none)
Type: defect (bug) | Status: new
Priority: high | Milestone: Awaiting Review
Component: Core | Version: 5.0.0
Severity: normal | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Changes (by shanebp):
* cc: shanebp (added)
Comment:
I see that notice frequently. Seems to happen when `get_avatar` is called
before BP is ready. It happens in wp-admin and on any ajax call. It
happens with various plugins and some page builders. For example, with
Avada:
{{{
wp-content/plugins/buddypress.5.1.0/bp-core/bp-core-avatars.php:200
bp_core_fetch_avatar()
wp-content/plugins/buddypress.5.1.0/bp-core/bp-core-avatars.php:1411
bp_core_get_avatar_data_url_filter()
wp-includes/class-wp-hook.php:288
apply_filters('get_avatar_url')
wp-includes/link-template.php:4249
get_avatar_data()
wp-includes/link-template.php:4017
get_avatar_url()
wp-includes/pluggable.php:2632
get_avatar()
wp-content/plugins/fusion-builder/shortcodes/fusion-user-login.php:170
FusionSC_Login::get_element_extras()
wp-content/plugins/fusion-builder/inc/helpers.php:1922
fusion_builder_frontend_data()
wp-content/plugins/fusion-builder/shortcodes/fusion-user-login.php:1327
fusion_element_login()
wp-includes/class-wp-hook.php:288
do_action('fusion_builder_before_init')
wp-content/plugins/fusion-builder/inc/class-fusion-builder.php:231
FusionBuilder->init()
wp-content/plugins/fusion-builder/inc/class-fusion-builder.php:205
FusionBuilder->__construct()
wp-content/plugins/fusion-builder/inc/class-fusion-builder.php:172
FusionBuilder::get_instance()
wp-content/plugins/fusion-builder/inc/bootstrap.php:41
fusion_builder_activate()
wp-includes/class-wp-hook.php:288
do_action('after_setup_theme')
wp-settings.php:507
}}}
The simplest solution is to insert a conditional to see if `$bp->avatar`
exists before the disabled avatars check which throws the notice: `!
$bp->avatar->show_avatars`.
I suggest that a hook be placed in that location. Sometimes devs need to
bail on that call without disabling avatars on the root site. Something
like: do_action( 'bp_core_avatar', $bp );
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8177#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list