opencredit / badgeos

BadgeOS is a plugin to WordPress that allows you to easily create badges and set up the steps and achievements users take to earn them. Badges are Mozilla OBI compatible and sharable via Credly.
http://www.badgeos.org
GNU Affero General Public License v3.0
92 stars 64 forks source link

PHP Fatal errors: Cannot redeclare CMB2 multiple select box & date range field functions #672

Open charmoney opened 5 years ago

charmoney commented 5 years ago

Description

BadgeOS includes the CMB2 multiple select box & date range fields without checking if they are already loaded. (Though the BadgeOS date range field appears to be a non-object oriented copy of the code predating WDS adding it to GitHub.) On existing WordPress sites that already use CMB2 and those field types, this causes PHP Fatal errors like:

PHP Fatal error: Cannot redeclare cmb2_render_select_multiple_field_type()

This is not an issue with CMB2. which safely loads itself only as needed. The issue is specifically with BadgeOS' loading of community produced additional field types for CMB2.

Steps to Reproduce

  1. Start with a stock WP installation
  2. Copy the CMB2 multiple select box field file mu-plugins.
    1. Download, install, and activate the & date range field plugin.
  3. Install BadgeOS
    1. Activate BadgeOS through the WP admin plugins page
    2. Encounter PHP fatal errors

Actual result:

WP crashes fatally when running BadgeOS and other plugins that use the multiple select or date range custom field types.

Expected result:

WP works when running BadgeOS and other plugins that use the multiple select or date range custom field types.

Product Versions

Additional Information

N/A

charmoney commented 5 years ago

Verified this fatal PHP error still occurs after PR #677 and the wordpress.org release of version 3.0.

charmoney commented 4 years ago

Verified this fatal PHP error still occurs after PR #704 and the wordpress.org release of version 3.3.

charmoney commented 4 years ago

Verified this fatal PHP error still occurs after the wordpress.org release of version 3.3.