Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: “My Threads” – User Specific Views


_ck_
Participant

@_ck_

Wow I was making it too complicated! Try this…

I managed to use internal functions but there’s a catch with get_recent_user_replies in that all topic data is not attached properly so I have to run through get_topic to pull all the cache data out again (the only proper way to do it without peeking in the cache directly)

<?php
/*
Plugin Name: my views
Description: views for a user's topics started and other participated topics
Plugin URI:
Author:
Version: 0.01
*/

function my_views_filter( $views ) {
global $views;
$views['my-topics'] = "Topics I've Started";
$views['my-posts'] = "Topics I've Participated In";
return $views;
}
add_filter('bb_views', 'my_views_filter');

function my_views_action( $view ) {
global $bbdb, $topics, $view_count; $user_id=bb_get_current_user_info( 'id' );
if ($view=='my-topics') {$topics=get_recent_user_threads($user_id); $view_count = count($topics);}
if ($view=='my-posts') {
$posts=get_recent_user_replies($user_id); $topics="";
foreach ($posts as $post) {$topics[]=get_topic($post->topic_id );}
$topics=bb_append_meta( $topics, 'topic' );
$view_count = count($topics);}
}
add_action( 'bb_custom_view', 'my_views_action' );

if (!function_exists(bb_get_view_title)) {
function bb_get_view_title($title) {
if (is_view()) {$title = get_view_name(). ' &laquo; ' . bb_get_option( 'name' ); }
return $title;
}
add_filter( 'bb_get_title', 'bb_get_view_title' );
}

?>

Skip to toolbar