Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 18:24

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 1 post ] 
Author Message
PostPosted: 01 Oct 2011, 18:00 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Topic-ID on Index

Make that all links to posts from index-page contains topic-id's (even if a 'last_post' is present)

May helpfull for Snippets/Mods or as Inspiration

To make this possible, it adds 2 additional SQL Queries to your board

open

index.php

find

Code:
    // Output page
    page_header($user->lang['INDEX']); 

before add

Code:
    // Topic-ID on Index / 4seven / 2011
        if (($user->data['user_id'] !== ANONYMOUS) && !$user->data['is_bot'])
        {
        
        $config_row_forum_last_post_id 
= explode(',', $config[(int)$user->data['user_id'] . '_last_post_id']);
        
            $sql 
= 'SELECT forum_id, topic_id, post_id
                    FROM '
 . POSTS_TABLE . '
                    WHERE '
 . $db->sql_in_set('post_id', $config_row_forum_last_post_id) . '
                    GROUP BY forum_id'
;
            $result = $db->sql_query_limit($sql, sizeof($config_row_forum_last_post_id));

            $topic_id_format = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, array('f' => '%1$s', 't' => '%2$s', 'p' => '%3$s', '#' => 'p' . '%3$s'));
            
            $config_row_forum_last_post_id 
= array_flip($config_row_forum_last_post_id);

        while ($row = $db->sql_fetchrow($result)){
     
            $rownr 
= $config_row_forum_last_post_id[$row['post_id']];
            
            $topic_id_url 
= sprintf($topic_id_format, $row['forum_id'], $row['topic_id'], $row['post_id']);
            

            $template
->alter_block_array('forumrow', array(
         
                     
'U_LAST_POST' => $topic_id_url
                     
            
), $rownr, 'change');}
     
            $db
->sql_freeresult($result);

        }
    // Topic-ID on Index / 4seven / 2011       

open

includes/functions_display.php

find

Code:
        foreach ($forum_rows as $row)
        

after add

Code:
            // Topic-ID on Index / 4seven / 2011
            $row_forum_last_post_id[] = $row['forum_last_post_id'];
            // Topic-ID on Index / 4seven / 2011        

find

Code:
            $last_catless = $catless;
        

after add

Code:
        // Topic-ID on Index / 4seven / 2011
        if (($user->data['user_id'] !== ANONYMOUS) && !$user->data['is_bot']){
        $row_forum_last_post_id = implode(',', $row_forum_last_post_id);
        if(isset($config[(int)$user->data['user_id'] . '_last_post_id'])){
        if($row_forum_last_post_id !==  $config[(int)$user->data['user_id'] . '_last_post_id']){
        set_config((int)$user->data['user_id'] . '_last_post_id', $row_forum_last_post_id);}}
        else{set_config((int)$user->data['user_id'] . '_last_post_id', $row_forum_last_post_id);}}
        // Topic-ID on Index / 4seven / 2011         


Note: You must be logged in at least 1 time as normal user, to see it as guest..

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.026s | 22 Queries | GZIP : Off ]