Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

#4550 closed defect (bug) (fixed)

BP_VERSION / BP_DB_VERSION constants are empty

Reported by: r-a-y's profile r-a-y Owned by:
Milestone: 1.7 Priority: normal
Severity: major Version: 1.7
Component: Core Keywords: has-patch
Cc:

Description

Because the BuddyPress::constants() method is called before BuddyPress::setup_globals() (where the version variables are defined), it's impossible to set the BP_VERSION and BP_DB_VERSION constants.

In the attached patch, I have moved $version and $db_version out of setup_globals() and into main class properties so the constants will still work and will not break any existing plugins relying on them.

Attachments (2)

4550.01.patch (1.5 KB) - added by r-a-y 12 years ago.
4550.02.patch (1.9 KB) - added by ddean 12 years ago.

Download all attachments as: .zip

Change History (7)

@r-a-y
12 years ago

#1 @johnjamesjacoby
12 years ago

I'd rather we reverse this approach for non-bootstrap constants; have a legacy constants method/function to separate non-essential constants (that aren't used anywhere by BuddyPress core anymore) apart from the overloading-constants (like _SLUG).

(Edit: huge run-on sentence; add punctuation.)

Last edited 12 years ago by johnjamesjacoby (previous) (diff)

#2 @DJPaul
12 years ago

  • Milestone changed from Awaiting Review to 1.7

#3 @ddean
12 years ago

Here's an alternate patch in line with JJJ's suggestion. I didn't touch the search slug, and
all other constants besides BP_VERSION and BP_DB_VERSION are used in setup_globals(), so the legacy constants method ended up pretty bare.

@ddean
12 years ago

#4 @dcavins
12 years ago

I noticed this problem because BP Template Pack started loading the wrong css file under BP 1.7 (it selects which css file to include based on BP being over or under 1.3). This patch restored expected behavior (bp_get_version returns the same version as BP_VERSION).

#5 @johnjamesjacoby
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6590]) Introduce legacy_constants() method, to handle the setting of old BuddyPress constants that some plugins might still look for. Props ddean. Fixes #4550.

Note: See TracTickets for help on using tickets.