bbp_remove_user_topic_subscription (intuser_id美元,inttopic_id美元)
从用户订阅中删除主题
描述
参数
- user_id美元
-
(int)(可选)用户id
- topic_id美元
-
(int)(可选)主题id
返回
(保龄球)如果主题已从用户订阅中删除,则为True,否则为false
源
函数bbp_remove_user_topic_subscription($user_id, $topic_id) {if(空($user_id) ||空($topic_id)){返回false;} $subscriptions = (array) bbp_get_user_subscribed_topic_ids($user_id);If (empty($subscriptions)){返回false;} $pos = array_search($topic_id, $subscriptions);If (false === $pos){返回false;} array_splice($subscriptions, $pos, 1);$subscriptions = array_filter($subscriptions);If (!empty($subscriptions)) {$subscriptions = implode(',', wp_parse_id_list($subscriptions));Update_user_option ($user_id, '_bbp_subscriptions', $subscriptions);} else {delete_user_option($user_id, '_bbp_subscriptions'); } wp_cache_delete( 'bbp_get_topic_subscribers_' . $topic_id, 'bbpress_users' ); do_action( 'bbp_remove_user_topic_subscription', $user_id, $topic_id ); return true; }
更新日志
版本 | 描述 |
---|---|
bbPress (r5156) | 介绍了。 |