vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Filter threads by post icon (https://vborg.vbsupport.ru/showthread.php?t=80570)

JMPZ 04-25-2005 10:00 PM

Filter threads by post icon
 
I couldn't understand why nobody had created this hack yet, so I made it myself.

This allows users to filter the threads by the icon. They do this by clicking on the icon in the forum thread listing. It then only shows threads with that same post icon.

Switching between pages works, as well as using the column sort functions. It is not designed to work properly with any other sort options but it might.

When posts are filtered, a "Unfilter" link is shown in the column header for thread post icons which, when clicked, removes the filter and returns the view to page 1.

Only 1 file needs to be modified, and 2 templates.

In forumdisplay.php, find
PHP Code:

globalize($_REQUEST, array('perpage' => INT'pagenumber' => INT'daysprune' => INT)); 

Replace with:
PHP Code:

//Post icon filter hack
//globalize($_REQUEST, array('perpage' => INT, 'pagenumber' => INT, 'daysprune' => INT));
globalize($_REQUEST, array('perpage' => INT'pagenumber' => INT'daysprune' => INT'picon'=> INT));
//*Post icon filter hack 


Find:
PHP Code:

    if ($daysprune != -1)
    {
        
$datecut "AND lastpost >= " . (TIMENOW - ($daysprune 86400));
        
$show['noposts'] = false;
    }
    else
    {
        
$datecut '';
        
$show['noposts'] = true;
    } 

And add immediately after it:
PHP Code:

//Post icon filter hack
    
if ($picon && is_numeric($picon) && $picon 5000) { //who knows if all this is necessary - better safe than sorry
      
$pqr " AND thread.iconid = '$picon' ";
      
$datecut .= $pqr;
      } else
        
$picon "";
//*post icon filter hack 


Find:
PHP Code:

        $pagenav construct_page_nav($totalthreads"forumdisplay.php?$session[sessionurl]f=$forumid""&sort=$sortfield&order=$sortorder&pp=$perpage&daysprune=$daysprune"); 

Replace with:

PHP Code:


//Post icon filter hack
//        $pagenav = construct_page_nav($totalthreads, "forumdisplay.php?$session[sessionurl]f=$forumid", "&sort=$sortfield&order=$sortorder&pp=$perpage&daysprune=$daysprune");
        
$pagenav construct_page_nav($totalthreads"forumdisplay.php?$session[sessionurl]f=$forumid""&sort=$sortfield&order=$sortorder&pp=$perpage&daysprune=$daysprune&picon=$picon");
//*post icon filter hack 

UPDATE 1.00 TO 1.01 ADD THIS MODIFICATION
Find:
PHP Code:

    $sorturl "forumdisplay.php?$session[sessionurl]f=$forumid&daysprune=$daysprune"

And add immediately after it:
PHP Code:

//Post icon filter hack
    
if ($pqr) {
      
$noiconurl $sorturl;
      
$sorturl .= "&picon=$picon";
      }
//*post icon filter hack 




Ok, for the templates, in threadbit, find:
Code:

<img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
And replace it with:
Code:

<a href="$sorturl&amp;picon=$thread[threadiconid]"><img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /></a>
Then in FORUMDISPLAY find:
Code:

        <if condition="$show['threadicons']">
                <td class="thead" colspan="2">&nbsp;</td>
        <else />
                <td class="thead">&nbsp;</td>
        </if>

And replace it with:

Code:

        <if condition="$show['threadicons']">
      <if condition="$picon">
        <td class="thead" colspan="2"><a href="$noiconurl">Unfilter</a></td>
      <else />
                <td class="thead" colspan="2">&nbsp;</td>
          </if>
        <else />
                <td class="thead">&nbsp;</td>
        </if>

It's working fine on our board. If you have any questions, just ask!

Jolten 04-26-2005 03:25 PM

I've wanted this for a bit, but couldn't figure it out. Thanks, this works perfectly.

HeloHi 04-27-2005 05:02 AM

This is great :)

HeloHi 04-27-2005 07:19 PM

where you have:

PHP Code:

if ($daysprune != -1
    { 
        
$datecut "AND lastpost >= " . (TIMENOW - ($daysprune 86400)); 
        
$show['noposts'] = false
    } 
    else 
    { 
        
$datecut ''
        
$show['noposts'] = true
    } 

I have:

PHP Code:

if (!$daysprune)
{
    if (
$bbuserinfo['daysprune'] != 0)
    {
        
$daysprune $bbuserinfo['daysprune'];
    }
    else
    {
        
$daysprune iif($foruminfo['daysprune'], $foruminfo['daysprune'], 30);
    }


and when I follow the instructions I get an error:

Parse error: parse error, unexpected T_ELSE in /home/parapla/public_html/forums/forumdisplay.php on line 514

where line 514 is
PHP Code:

$daysprunesel iif($daysprune == -1'all'$daysprune); 

Forgive me but I am extremely novice about these things! What do I need to do to make this work?

Jolten 04-27-2005 11:04 PM

Quote:

Originally Posted by HeloHi
Forgive me but I am extremely novice about these things! What do I need to do to make this work?


You may want to update to 3.0.7 first.

HeloHi 04-27-2005 11:29 PM

Quote:

Originally Posted by Jolten
You may want to update to 3.0.7 first.


I have updated, I thought. Is that code from the older version or something?

See: www.forums.paraplanet.com it is 3.07


Edit: Hehe I hadn't updated my profile, sorry about that! Any thoughts on what I can do?

JMPZ 04-30-2005 07:19 PM

Quote:

Originally Posted by HeloHi
I have updated, I thought. Is that code from the older version or something?

See: www.forums.paraplanet.com it is 3.07


Edit: Hehe I hadn't updated my profile, sorry about that! Any thoughts on what I can do?

EDIT: As mentioned below, he needed to look further down in the code to find the right piece.

Lynne 04-30-2005 07:40 PM

Quote:

Originally Posted by HeloHi
I have updated, I thought. Is that code from the older version or something?

See: www.forums.paraplanet.com it is 3.07


Edit: Hehe I hadn't updated my profile, sorry about that! Any thoughts on what I can do?

You are at the wrong part of the code. Keep looking in the php file and you will find that code JMPZ is talking about.

Lynne 04-30-2005 08:02 PM

Where is "$noiconurl" defined? I'm just wondering because mine won't 'unfilter' and since I don't see that defined, I'm thinking that may be the culprit.

HeloHi 04-30-2005 08:37 PM

Quote:

Originally Posted by Lynne
You are at the wrong part of the code. Keep looking in the php file and you will find that code JMPZ is talking about.

That is exactly it! Thanks so much! I am trying to get better :surprised:

edit: it works perfectly now :)


All times are GMT. The time now is 12:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01232 seconds
  • Memory Usage 1,781KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (11)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete