Skip to:
Content

bbPress.org


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/includes/users/engagements.php

    r6828 r6876  
    461461 * @param array $args Optional. Arguments to pass into bbp_has_topics()
    462462 *
    463  * @return bool True if user has favorites, otherwise false
     463 * @return array Array of topics if user has favorites, otherwise empty array
    464464 */
    465465function bbp_get_user_favorites( $args = array() ) {
    466466    $r     = bbp_get_user_object_query( $args, 'favorites', '_bbp_favorite' );
    467     $query = bbp_has_topics( $r );
     467    $query = ! empty( $r )
     468        ? bbp_has_topics( $r )
     469        : array();
    468470
    469471    // Filter & return
     
    679681 * @param array $args Optional. Arguments to pass into bbp_has_topics()
    680682 *
    681  * @return bool True if user has topic subscriptions, otherwise false
     683 * @return array Array of topics if user has topic subscriptions, otherwise empty array
    682684 */
    683685function bbp_get_user_topic_subscriptions( $args = array() ) {
    684686    $r     = bbp_get_user_object_query( $args, 'topic_subscriptions', '_bbp_subscription' );
    685     $query = bbp_has_topics( $r );
     687    $query = ! empty( $r )
     688        ? bbp_has_topics( $r )
     689        : array();
    686690
    687691    // Filter & return
     
    697701 * @param array $args Optional. Arguments to pass into bbp_has_forums()
    698702 *
    699  * @return bool True if user has forum subscriptions, otherwise false
     703 * @return array Array of forums if user has forum subscriptions, otherwise empty array
    700704 */
    701705function bbp_get_user_forum_subscriptions( $args = array() ) {
    702706    $r     = bbp_get_user_object_query( $args, 'forum_subscriptions', '_bbp_subscription' );
    703     $query = bbp_has_forums( $r );
     707    $query = ! empty( $r )
     708        ? bbp_has_forums( $r )
     709        : array();
    704710
    705711    // Filter & return
Note: See TracChangeset for help on using the changeset viewer.