function add_topic_tag($topic_id, $tag) { bb_log_deprecated('function', __FUNCTION__, 'bb_add_topic_tag'); return bb_add_topic_tag($topic_id, $tag); }
function bb_merge_tags($old_id, $new_id) { if (!bb_current_user_can('manage_tags')) { return false; } $old_id = (int) $old_id; $new_id = (int) $new_id; if ($old_id == $new_id) { return false; } do_action('bb_pre_merge_tags', $old_id, $new_id); // Get all topics tagged with old tag $old_topics = bb_get_tagged_topic_ids($old_id); // Get all toics tagged with new tag $new_topics = bb_get_tagged_topic_ids($new_id); // Get intersection of those topics $both_topics = array_intersect($old_topics, $new_topics); // Discard the intersection from the old tags topics $old_topics = array_diff($old_topics, $both_topics); // Add the remainder of the old tag topics to the new tag if (count($old_topics)) { $new_tag = bb_get_tag($new_id); foreach ($old_topics as $old_topic) { bb_add_topic_tag($old_topic, $new_tag->slug); } } // Destroy the old tag $old_tag = bb_destroy_tag($old_id); return array('destroyed' => $old_tag, 'old_count' => count($old_topics), 'diff_count' => count($both_topics)); }
function insert_tags($topic_id, $tags) { foreach ($tags as $tag) { if (!$this->tag_exists($tag)) { bb_add_topic_tag($topic_id, $tag); } } }