Constants Already Defined

There are very specific reasons that we do not want the Pro theme to know that Gravity Forms is enabled and have defined X_GRAVITY_FORMS_IS_ACTIVE as false. We do this, as is best practice, wrapped in an if statement to make sure that it is not already defined.

However, in the file framework/functions/plugins/setup.php (line 25 in v2.3.6), it is again defined and a PHP notice is thrown:

( ! ) Notice: Constant X_GRAVITY_FORMS_IS_ACTIVE already defined in …/wp-content/themes/pro/framework/functions/plugins/setup.php on line 25

Albeit just a notice, I would definitely consider this a bug and poor coding practices.

In the meantime, I have used notice suppression on that line, but this is a sloppy workaround and will not play well when updates to the theme are made.

Please advise as to how this should be handled.

I have also found the same issue in framework/functions/plugins/buddypress.php.

define( 'BP_AVATAR_THUMB_WIDTH', 45 );
define( 'BP_AVATAR_THUMB_HEIGHT', 45 );
define( 'BP_AVATAR_FULL_WIDTH', 100 );
define( 'BP_AVATAR_FULL_HEIGHT', 100 );

BuddyPress even does this in their own code!!!

	if ( !defined( 'BP_AVATAR_THUMB_WIDTH' ) )
		define( 'BP_AVATAR_THUMB_WIDTH', 50 );

	if ( !defined( 'BP_AVATAR_THUMB_HEIGHT' ) )
		define( 'BP_AVATAR_THUMB_HEIGHT', 50 );

	if ( !defined( 'BP_AVATAR_FULL_WIDTH' ) )
		define( 'BP_AVATAR_FULL_WIDTH', 150 );

	if ( !defined( 'BP_AVATAR_FULL_HEIGHT' ) )
		define( 'BP_AVATAR_FULL_HEIGHT', 150 );

Hi,

Thanks for writing in!

Those constants are not designed to be overridden in the child theme.
It’s something the theme uses to check which plugins are enable so it can load or not load specific resources to prevent conflicts with other plugins and features of the theme.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.