Skip to:
Content

bbPress.org

Changeset 6876 for trunk/src/bbpress.php


Ignore:
Timestamp:
12/04/2018 06:31:09 PM (3 years ago)
Author:
johnjamesjacoby
Message:

Engagements: next pass at back-compat for pre-2.6 user strategy.

  • Renames BBP_User_Engagements_Back_Compat to BBP_User_Engagements_User so the approach is more clear.
  • Fill in get_query() method, left todo from r6844.
  • Move active strategy into a preloaded option, default to meta
  • Set active strategy to user on failed auto-upgrade to 2.6 to maintain backwards compatibility
  • Introduces sub-actions to assist with abstracting the engagement strategy setup

Fixes #3211.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bbpress.php

    r6854 r6876  
    299299        $this->errors         = new WP_Error(); // Feedback
    300300
    301         /** Engagements *******************************************************/
    302 
    303         $this->engagements    = new BBP_User_Engagements_Meta(); // Meta strategy interface
    304 
    305301        /** Deprecated ********************************************************/
    306302
     
    407403            'setup_theme',              // Setup the default theme compat
    408404            'setup_current_user',       // Setup currently logged in user
     405            'setup_engagements',        // Setup user engagements strategy
    409406            'roles_init',               // User roles init
    410407            'register_meta',            // Register meta (forum|topic|reply|user)
     
    792789
    793790    /**
     791     * Setup the user engagements strategy
     792     *
     793     * @since 2.6.0 bbPress (r6875)
     794     */
     795    public function setup_engagements() {
     796
     797        // Default (always exists)
     798        $default    = "BBP_User_Engagements_Meta";
     799
     800        // Configured (Might not exist)
     801        $strategy   = ucwords( bbp_engagements_strategy() );
     802        $class_name = "BBP_User_Engagements_{$strategy}";
     803
     804        // Setup the engagements interface
     805        $this->engagements = class_exists( $class_name )
     806            ? new $class_name
     807            : new $default;
     808    }
     809
     810    /**
    794811     * Initialize forum-specific roles
    795812     *
Note: See TracChangeset for help on using the changeset viewer.