Skip to:
Content

BuddyPress.org

Changeset 11073


Ignore:
Timestamp:
09/09/2016 03:54:27 PM (10 years ago)
Author:
boonebgorges
Message:

Add actions to BP taxonomy wrappers that modify the database.

These actions mirror those in WP's wp_set_object_terms() and
wp_remove_object_terms(), but pass a full complement of parameters.
See ​https://core.trac.wordpress.org/ticket/38006.

The new actions can be used, in part, for cache invalidation.

See #5451.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-taxonomy.php

    r10899 r11073  
    9292        }
    9393
    94         $retval = wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
     94        $tt_ids = wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
    9595
    9696        if ( $switched ) {
    … …  
    9898        }
    9999
    100         return $retval;
     100        /**
     101         * Fires when taxonomy terms have been set on BuddyPress objects.
     102         *
     103         * @since 2.7.0
     104         *
     105         * @param int    $object_id Object ID.
     106         * @param array  $terms     Term or terms to remove.
     107         * @param array  $tt_ids    Array of term taxonomy IDs.
     108         * @param string $taxonomy  Taxonomy name.
     109         */
     110        do_action( 'bp_set_object_terms', $object_id, $terms, $tt_ids, $taxonomy );
     111
     112        return $tt_ids;
    101113}
    102114
    … …  
    169181        }
    170182
     183        /**
     184         * Fires when taxonomy terms have been removed from BuddyPress objects.
     185         *
     186         * @since 2.7.0
     187         *
     188         * @param int    $object_id Object ID.
     189         * @param array  $terms     Term or terms to remove.
     190         * @param string $taxonomy  Taxonomy name.
     191         */
     192        do_action( 'bp_remove_object_terms', $object_id, $terms, $taxonomy );
     193
    171194        return $retval;
    172195}
Note: See TracChangeset for help on using the changeset viewer.