Seite 1 von 1

latest active topics..scrolling...Nicht öffentliche Bereiche

Verfasst: 28.09.2003 18:52
von slanki
Hallo, habe mir folgenden Mod eingebaut...

Code: Alles auswählen

##############################################################
## MOD Title: 10 latest active topics
## MOD Author: zparta < zparta@upnorth.se > (Jens Holmqvist) http://www.upnorth.se
## MOD Description: Show The 10 latest topics on forum index
## MOD Version: 1.0.4
... und er läuft wunderbar. Die letzten Topics scrollen schön über den Bildschirm. :D :D
Bis auf eine sache die mich schon stört, und zwar zeigt er mir alle themen an auch die nur für bestimmte Gruppen sind.
Ich denke an dem folgenden Code müsste man etwas drehen

Code: Alles auswählen

   // Get Viewable Forums
   //
   $is_auth_ary = array();
   $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
   $auth_view_forum_sql = '';
   for($i = 0; $i < $total_categories; $i++)
   {
      $cat_id = $category_rows[$i]['cat_id'];
      $display_forums = false;
      for($j = 0; $j < $total_forums; $j++)
      {
         if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
         {
            $display_forums = true;
            $auth_view_forum_sql .= ($auth_view_forum_sql == '' ? '' : ', ' ) . $forum_data[$j]['forum_id'];
         }
      }
   }
   $auth_view_forum_sql = ($auth_view_forum_sql == '' ? '(0)' : '(' . $auth_view_forum_sql . ')');
   //
   // Get The Data
   //
   $sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, t.topic_type, p.post_id, p.poster_id,
      p.post_time, u.user_id, u.username, u.user_lastvisit
      FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
      WHERE t.forum_id IN " . $auth_view_forum_sql . " AND t.topic_id = p.topic_id
         AND f.forum_id = t.forum_id
         AND t.topic_status <> 2
         AND p.post_id = t.topic_last_post_id
         AND p.poster_id = u.user_id
      ORDER BY t.topic_last_post_id DESC";
    if ( !($result = $db->sql_query($sql)) )
    {
       message_die(GENERAL_ERROR, 'Could not query recent posts marquee information', '', __LINE__, __FILE__, $sql);
    }
    if ($row = $db->sql_fetchrowset($result))
    {
       $db->sql_freeresult($result);
    }
    if( count($row) <= 10 )
    {
       $topics = count($row);
    }
    else
    {
       $topics = 10;
    }
    for($i = 0; $i < $topics; $i++)
    {
         $mar_title = $row[$i]["topic_title"];
         $mar_url = $phpbb_root_path . 'viewtopic.php?t='.$row[$i]["topic_id"];
         $mar_user = $row[$i]["username"];
         $mar_date = date('F j, Y, g:i a', $row[$i]["post_time"]);
         if ( $row[$i]["topic_type"] == POST_GLOBAL_ANNOUNCE ) { if ( $row[$i]["post_time"] >  $row[$i]["user_lastvisit"] ){ $pic = $phpbb_root_path . 'templates/subSilver/images/folder_global_announce_new.gif'; }else{ $pic = $phpbb_root_path . 'templates/subSilver/images/folder_global_announce.gif'; } }
         else if ( $row[$i]["topic_type"] == POST_ANNOUNCE ) { if ( $row[$i]["post_time"] >  $row[$i]["user_lastvisit"] ){ $pic = $phpbb_root_path . 'templates/subSilver/images/folder_announce_new.gif'; }else{ $pic = $phpbb_root_path . 'templates/subSilver/images/folder_announce.gif'; } }
         else if ( $row[$i]["topic_type"] == POST_STICKY ) { if ( $row[$i]["post_time"] >  $row[$i]["user_lastvisit"] ){ $pic = $phpbb_root_path . 'templates/subSilver/images/folder_sticky_new.gif'; }else{ $pic = $phpbb_root_path . 'templates/subSilver/images/folder_sticky.gif'; } }
         else { if ( $row[$i]["post_time"] >  $userdata['user_lastvisit'] ){ $pic = $phpbb_root_path . 'templates/subSilver/images/folder_new.gif'; }else{ $pic = $phpbb_root_path . 'templates/subSilver/images/folder.gif'; } }
         $template->assign_block_vars('marqueerow', array(
            'FOLD_URL' => $pic,
            'TOPIC_TITLE' => $row[$i]["topic_title"],
            'TOPIC_URL' => $phpbb_root_path . 'viewtopic.php?t='.$row[$i]["topic_id"],
            'USERNAME' => $row[$i]["username"],
            'USER_PROF' => $phpbb_root_path . 'profile.php?mode=viewprofile&u='.$row[$i]["user_id"],
            'POST_DATE' => date('F j, Y, g:i a', $row[$i]["post_time"]))
         );
    }
Wäre genial wenn ihr mir weiterhelfen könntet.:P :P :P :P
Mfg

Verfasst: 29.09.2003 12:27
von itst
Schau Dir mal die SQL-Query von unseren RDF-Generator an: http://phpbb.de/rdf/rdf.phps

Code: Alles auswählen

$sql = "SELECT t.topic_id, t.topic_title, p.post_id, p.post_time, pt.post_text, pt.bbcode_uid, f.forum_name
    FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . POSTS_TEXT_TABLE . " AS pt, " . FORUMS_TABLE . " AS f
    WHERE
        f.forum_id = t.forum_id
            AND f.auth_view = " . AUTH_ALL . "
            AND p.topic_id = t.topic_id
            AND p.post_id = $sql_post_id_field
            AND pt.post_id = p.post_id
            $sql_where
    ORDER BY $sql_orderby LIMIT $count";
Wichtig dabei ist

Code: Alles auswählen

... f.auth_view = " . AUTH_ALL . " ...

Verfasst: 29.09.2003 18:39
von slanki
Danke für den Tipp, jetzt läufts :D :D :D :D