Changeset 1296

Show
Ignore:
Timestamp:
08/19/08 09:32:32 (3 months ago)
Author:
_ck_
Message:

0.1.2 new view: "Topics with new posts" (requires Unread Posts plugin)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • my-views/trunk/my-views-started-participated-topics.php

    r998 r1296  
    66Author: _ck_ 
    77Author URI: http://bbShowcase.org 
    8 Version: 0.1.1 
     8Version: 0.1.2 
    99*/  
    1010 
    1111if (is_callable('bb_register_view')) {  // Build 876+   alpha trunk 
    1212 
    13 function my_views_add_started_participated_topics() {    
     13function my_views_add_started_participated_topics() {           
    1414        $query = array('append_meta'=>false,'sticky'=>false);   // attempt to short-circuit bb_query 
    1515        bb_register_view("latest-discussions","Latest Discussions", $query); 
    1616        if (bb_is_user_logged_in()) { 
     17                if (function_exists('unread_posts_init')  ) {bb_register_view("new-posts","Topics with new posts",$query);} 
    1718                bb_register_view("my-topics","Topics I've Started",$query); 
    18                 bb_register_view("my-posts","Topics I've Participated In",$query); 
     19                bb_register_view("my-posts","Topics I've Participated In",$query);              
    1920        } 
    2021}        
     
    2728        $views['latest-discussions'] = "Latest Discussions"; 
    2829        if (bb_is_user_logged_in()) { 
     30                if (function_exists('unread_posts_init') ) {$views['new-posts'] = "Topics with new posts";} 
    2931                $views['my-topics'] = "Topics I've Started"; 
    3032                $views['my-posts'] = "Topics I've Participated In";              
     
    3941$user_id=bb_get_current_user_info( 'id' ); 
    4042 
    41 if ($view=='latest-discussions' || ($user_id && ($view=='my-topics' || $view=='my-posts')))  { 
     43if ($view=='latest-discussions' || ($user_id && ($view=='my-topics' || $view=='my-posts' || $view=='new-posts')))  { 
    4244        // $topics=get_recent_user_threads($user_id);  $view_count  = count($topics); 
    4345        $limit = bb_get_option('page_topics'); 
     
    5860                $where = $where." AND topic_id IN ($ids) ";                      
    5961                } 
     62                 
     63                elseif ($view=='new-posts') { 
     64                global $up_last_login, $up_read_topics, $up_read_posts; 
     65                $where= $where." AND topic_time>'".gmdate("Y-m-d H:i:s",$up_last_login-86400*2)."' ";  // go back 48 hours just to give them something if empty 
     66                if (isset($up_read_posts) && is_array($up_read_posts)) { 
     67                        $where.=" AND topic_id IN {".implode(',',$up_read_topics)."} AND topic_last_post_id NOT IN {".implode(',',$up_read_posts)."} "; 
     68                } 
     69                } 
    6070        } 
    6171        $query = " FROM $bbdb->topics $where "; 
  • my-views/trunk/my-views.php

    r998 r1296  
    66Author: _ck_ 
    77Author URI: http://bbShowcase.org 
    8 Version: 0.1.1 
    9  
    10 History 
    11 0.03    : first public release, for 0.8.2.x only 
    12 0.04    : now trunk compatibility 
    13 0.05    : breakup of view modules into seperate, optional plugins 
    14 0.06    : available/installed plugins improvements (totals, sorting) 
    15 0.07    : additional modules (statistics, available themes)       Statistics is not finished yet and Themes requires bbPress Theme Switcher 
    16 0.08    : bug fix for passthrough adding views to 0.8.2.x , optional header & footer for internal views, optional .my_views_header class 
    17 0.09    : pagination (multi-page) support added for versions >0.8.3 & add label "pages: " (or any text) to list of pages 
    18 0.091   : quick fix for removing duplicated/misplaced stickies & incorrect sorting orders 
    19  
    20 To Do: 
    21 admin interface 
    22 deal with stickies confusing view results 
    23 rename views 
    24 make table sort optional 
    25 translation ability 
    26  
    27 Features: 
    28 ability to change view list order  
    29 remove any view 
    30 label list of pages with "pages: " or any custom text 
    31  
     8Version: 0.1.2 
     9 
     10License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ 
     11 
     12Donate: http://amazon.com/paypage/P2FBORKDEFQIVM 
    3213*/ 
    3314 
     
    3819 
    3920$my_views['prefered_order']=array(      // force views to list in the order that you desire 
    40         "latest-discussions","no-replies","untagged","my-topics","my-posts","most-views","most-posts","least-views","least-posts","support-forum-no", 
     21        "latest-discussions","no-replies","untagged","my-topics","my-posts","new-posts","most-views","most-posts","least-views","least-posts","support-forum-no", 
    4122        "installed-plugins","available-plugins","installed-themes","available-themes","statistics" 
    4223        ); 
     
    298279 
    299280function ts_sort_recursive_comma(a,b) {  
     281try { 
    300282    aa = parseInt(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).replace(/[^0-9]/g,'')); 
    301283    if (isNaN(aa)) aa = 0; 
     
    303285    if (isNaN(bb)) bb = 0; 
    304286    return aa - bb; 
     287} catch(dummy) {return 0;}     
    305288} 
    306289 
  • my-views/trunk/readme.txt

    r998 r1296  
    33Contributors: _ck_ 
    44Requires at least: 0.8.2 
    5 Tested up to:  trunk alpha 1075 
     5Tested up to:  0.9.0.2 
    66Stable tag: trunk 
    77Donate link: http://amazon.com/paypage/P2FBORKDEFQIVM 
     
    103103*       fix for improper WHERE filter use to peacefully co-exist with Hidden Forums plugin 
    104104 
     105Version 0.1.2 (2008-08-19) 
    105106 
     107*       additional view: "Topics with new posts"  (requires Unread Posts plugin by _ck_ ) Part of "started-participated" view. 
     108 
     109== To Do == 
     110 
     111* admin interface 
     112 
     113* deal with stickies confusing view results 
     114 
     115* rename views 
     116 
     117* make table sort optional 
     118 
     119* translation ability 
     120 
     121