/** * Build output for the subscriptions column. * * @see manage_users_custom_column filter trigger * * @param string $value * @param string $column_name * @param int $user_id * @return string column content */ public static function subscriptions_column($value, $column_name, $user_id) { if (self::$subscriptions_column_name !== $column_name) { return $value; } $column_content = ''; $edit_url = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_id))); $signup_lists = Prompt_Subscribing::get_signup_lists(); foreach ($signup_lists as $signup_list) { $column_content .= self::signup_list_column_content($user_id, $signup_list, $edit_url); } $author_count = count(Prompt_User::subscribed_object_ids($user_id)); if ($author_count > 0) { $column_content .= html('a', array('href' => $edit_url . '#prompt-author-subscriptions'), sprintf(_n('%d Author', '%d authors', $author_count), $author_count), '<br/>'); } $post_count = count(Prompt_Post::subscribed_object_ids($user_id)); if ($post_count > 0) { $column_content .= html('a', array('href' => $edit_url . '#prompt-post-subscriptions'), sprintf(_n('%d Conversations', '%d Conversations', $post_count), $post_count), '<br/>'); } return $column_content; }
/** * @since 1.0.0 * @return string */ protected function profile_post_subscriptions() { $subscribed_post_ids = Prompt_Post::subscribed_object_ids($this->id); if (empty($subscribed_post_ids)) { return ''; } $post_items = ''; foreach ($subscribed_post_ids as $post_id) { $post_items .= html('li', $this->profile_subscription_checkbox(new Prompt_Post($post_id)), comments_open($post_id) ? '' : __('(closed)', 'Postmatic')); } return html('div id="prompt-post-subscriptions"', html('h4', __('Discussions you are subscribed to:', 'Postmatic')), html('ul', $post_items)); }