Checking if the BuddyPress component is available before using it.
-
Hi There,
Cool plugin, i really like it.
One issue, i came across accidently is that if you have the notification component disabled, and any of the notifications options enabled, the plugin would through a Fatal error ever time you try to verify of unverify a member.
I know it’s a bit far fetched and unlikely that someone would enable the verification notifications settings without enabling the BP or BB notification component. But still a fatal error crash is certainly not the way!
Fatal error: Uncaught Error: Call to undefined function bp_notifications_add_notification()
in wp-content\plugins\bp-verified-member\inc\class-bp-verified-member.php on line 1293
Call stack:
BP_Verified_Member::create_verified_status_updated_notification()
wp-includes/class-wp-hook.php:324
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:348
WP_Hook::do_action()
wp-includes/plugin.php:517
do_action()
wp-content/plugins/bp-verified-member/admin/class-bp-verified-member-admin.php:433
BP_Verified_Member_Admin::before_update_user_meta()
wp-includes/class-wp-hook.php:324
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:348
WP_Hook::do_action()
wp-includes/plugin.php:517
do_action()
wp-includes/meta.php:290
update_metadata()
wp-includes/user.php:1199
update_user_meta()
wp-content/plugins/bp-verified-member/admin/class-bp-verified-member-admin.php:162
BP_Verified_Member_Admin::toggle_verified_member()
wp-includes/class-wp-hook.php:322
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:348
WP_Hook::do_action()
wp-includes/plugin.php:517
do_action()
wp-admin/admin-ajax.php:192That’s because in the function create_verified_status_updated_notification where bp_notifications_add_notification functions is used, there’s no check if the notifications component is enabled.
I think the check here would be sufficient as opposed to checking when the Notifications options are changed just in case somebody have the notifications disabled and would change their minds in the future.
Cheers!
Anas
- The topic ‘Checking if the BuddyPress component is available before using it.’ is closed to new replies.