_bb_make_tag_compat

Adds some back-compat properties/elements to a term.

Description

_bb_make_tag_compat( &$tag ); 

Casting $tag->term_taxonomy_id to an integer is important since we check it against is_integer() in bb_get_tag()

Parameters (1)

0. $tag
The tag.

Usage

  1. if ( !function_exists( '_bb_make_tag_compat' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php'; 
  3.  
  4. // The tag. 
  5. $tag = &$tag; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _bb_make_tag_compat($tag); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php  
  1. function _bb_make_tag_compat( &$tag ) { 
  2. if ( is_object($tag) && isset($tag->term_id) ) { 
  3. $tag->term_taxonomy_id = (int) $tag->term_taxonomy_id; 
  4. $tag->tag_id =& $tag->term_taxonomy_id; 
  5. $tag->tag =& $tag->slug; 
  6. $tag->raw_tag =& $tag->name; 
  7. $tag->tag_count =& $tag->count; 
  8. } elseif ( is_array($tag) && isset($tag['term_id']) ) { 
  9. $tag['term_taxonomy_id'] = (int) $tag['term_taxonomy_id']; 
  10. $tag['tag_id'] =& $tag['term_taxonomy_id']; 
  11. $tag['tag'] =& $tag['slug']; 
  12. $tag['raw_tag'] =& $tag['name']; 
  13. $tag['tag_count'] =& $tag['count'];