Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40

Thread: Filter News Module by Thread Prefix

  1. #21

    Default

    Ah, this is something I've been trying to do and got stuck as well.

    Is there any solution for the above problem as described by caitian?

  2. #22
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,466

    Default

    Look in your modules/news.php file around line 130 for this query, add the part marked in red, and that should take care of the problem:
    Code:
    			$getnewsids = $db->query_read("
    				SELECT $ratingsql threadid, firstpostid
    				FROM " . TABLE_PREFIX . "thread AS thread
    				WHERE visible = 1
    					AND thread.prefixid = 'X'
    					AND open != 10
    					AND (thread.forumid IN(" . implode(',', $mods['inforums']) . ")
    					" . iif(!empty($newstids), ' OR threadid IN(' . implode(',', $newstids) . ')') . "
    					)
    					" . iif($mod_options['portal_news_cutoffdate'], 'AND thread.dateline > ' . (TIMENOW - ($mod_options['portal_news_cutoffdate'] * 86400))) . "
    				ORDER BY " . iif($mod_options['portal_news_sticky'], 'sticky DESC,') . iif($mod_options['portal_news_orderby'] == 'postdateline', 'dateline', $mod_options['portal_news_orderby']) . " $mod_options[portal_news_direction]
    				$newslimit
    			");
    (don't forget to change the X to your prefixid)
    Frequently Asked Questions
    CMPS Users Manual

    For vBadvanced software assistance, please use the support forums.
    Unsolicted PMs, IMs, and email will not be responded to.
    If you have a non-software related question or problem with your account, please submit a support ticket.

  3. #23

    Default

    Fantastic. Thank you Brian, I will test this tonight.

  4. #24

    Default

    Tested and working fine.

    A million thanks Brian.

  5. #25
    Join Date
    Dec 2006
    Posts
    15

    Default

    Thanks for the reply, Brian.

    This topic is nominated for the Thread of The Year!

  6. #26
    Join Date
    May 2009
    Posts
    1

    Default

    Quote Originally Posted by Brian View Post
    You should be able to do that by adding a new plugin to the 'vba_cmps_module_recthreads_start' hook location with the following code:
    Code:
    $vba_threads_condition .= " AND thread.prefixid = 'X'";
    Replace the 'X' there with the "Prefix ID" from the prefix you'd like to use.
    Could you explain in detail how to do it please?
    I've tried and not working

    thanks in advance and sorry my english!

  7. #27
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,466

    Default

    Admin CP => Plugins & Products => Add New Plugin

    Product: vBadvanced CMPS
    Hook Location: vba_cmps_module_recthreads_start
    Title: {your choice}
    Execution Order: 5
    Plugin PHP Code: {the code I posted originally}
    Frequently Asked Questions
    CMPS Users Manual

    For vBadvanced software assistance, please use the support forums.
    Unsolicted PMs, IMs, and email will not be responded to.
    If you have a non-software related question or problem with your account, please submit a support ticket.

  8. #28
    Join Date
    May 2009
    Posts
    12

    Default

    I have one question.

    If I would want to have 3 cmps pages, each with a different prefix to pull the threads from, how would I do this? Create 3 seperate news.php files, each with another id inserted with the new code, then make 3 copies of the news module. Would that work? And would the fix to only count threads with a prefix also still work?

  9. #29
    Join Date
    May 2009
    Posts
    12

    Default

    Anybody?

  10. #30
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,466

    Default

    It would probably be easier just to modify that query a little and use a switch statement instead. First change the query in your news.php file to this:
    Code:
    WHERE thread.threadid IN(" . implode(',', $newstids) . ") AND thread.prefixid = '$newsprefix'
    Then somewhere above that query, add some code that looks something like this:
    PHP Code:
    switch($page['identifier'])
    {
        case 
    'page1':
            
    $newsprefix 'page1prefix';
        break;

        case 
    'page2':
            
    $newsprefix 'page2prefix';
        break;

        case 
    'page3':
            
    $newsprefix 'page3prefix';
        break;

        default:
            
    $newsprefix 'defaultprefix';

    Replace the spots where you see page1, page2, and page3 with the page identifiers from the CMPS pages that you want to use different news prefixes with, and then change the corresponding page1prefix, page2prefix, and page3prefix bits to the prefix you want to use on those pages.
    Frequently Asked Questions
    CMPS Users Manual

    For vBadvanced software assistance, please use the support forums.
    Unsolicted PMs, IMs, and email will not be responded to.
    If you have a non-software related question or problem with your account, please submit a support ticket.

  11. #31
    Join Date
    May 2005
    Posts
    9

    Default

    Fixed!
    Last edited by Cerbero; 11-15-2009 at 07:22 PM.

  12. #32
    Join Date
    May 2005
    Posts
    9

    Default

    Ops... is there a way to have thread order by prefix.displayorder ?
    Thanks for your help!

  13. #33
    Join Date
    May 2005
    Posts
    9

    Default

    It isn't possible to order by prefix order???
    Thanks

  14. #34
    Join Date
    May 2005
    Posts
    9

    Default

    Anyone??

  15. #35
    Join Date
    Jan 2008
    Posts
    158

    Default

    Is it possible to add multiple thread prefixes? If so, what would the code look like?

  16. #36
    Join Date
    Nov 2009
    Posts
    10

    Default

    Quote Originally Posted by Brian View Post
    It would probably be easier just to modify that query a little and use a switch statement instead. First change the query in your news.php file to this:
    Code:
    WHERE thread.threadid IN(" . implode(',', $newstids) . ") AND thread.prefixid = '$newsprefix'
    Then somewhere above that query, add some code that looks something like this:
    PHP Code:
    switch($page['identifier'])
    {
        case 
    'page1':
            
    $newsprefix 'page1prefix';
        break;

        case 
    'page2':
            
    $newsprefix 'page2prefix';
        break;

        case 
    'page3':
            
    $newsprefix 'page3prefix';
        break;

        default:
            
    $newsprefix 'defaultprefix';

    Replace the spots where you see page1, page2, and page3 with the page identifiers from the CMPS pages that you want to use different news prefixes with, and then change the corresponding page1prefix, page2prefix, and page3prefix bits to the prefix you want to use on those pages.
    I can not make it work:
    PHP Code:
    switch($page['identifier'])
    {
        case 
    'GEHO':
            
    $newsprefix 'GE_Hidden_Object';
        break;

        case 
    'DMA':
            
    $newsprefix 'GE_Dash_Match_Action';
        break;

        default:
            
    $newsprefix '';
    }          
            if (!empty(
    $mods['inforums']))
            {
                
    $getnewsids $db->query_read("
                    SELECT 
    $ratingsql threadid, firstpostid
                    FROM " 
    TABLE_PREFIX "thread AS thread
                    WHERE visible = 1
                        AND thread.prefixid = '
    $newsprefix'
                        AND open != 10
                        AND (thread.forumid IN(" 
    implode(','$mods['inforums']) . ")
                        " 
    iif(!empty($newstids), ' OR threadid IN(' implode(','$newstids) . ')') . "
                        )
                        " 
    iif($mod_options['portal_news_cutoffdate'], 'AND thread.dateline > ' . (TIMENOW - ($mod_options['portal_news_cutoffdate'] * 86400))) . "
                    ORDER BY " 
    iif($mod_options['portal_news_sticky'], 'sticky DESC,') . iif($mod_options['portal_news_orderby'] == 'postdateline''dateline'$mod_options['portal_news_orderby']) . $mod_options[portal_news_direction]
                    
    $newslimit
                "
    ); 
    I enter: index.php?pageid=GEHO and nothing shows.
    however, if replacement AND thread.prefixid = '$newsprefix'
    by
    AND thread.prefixid = 'GE_Hidden_Object'
    if it works

    It is as if the page does not identify.

    Help Please!

  17. #37
    Join Date
    Nov 2009
    Posts
    10

    Default

    Solved:
    PHP Code:
    switch($pages['name'])
    {
        case 
    'GEHO':
            
    $newsprefix 'GE_Hidden_Object';
        break;

        case 
    'GEDMA':
            
    $newsprefix 'GE_Dash_Match_Action';
        break;

        default:
            
    $newsprefix '';


  18. #38
    Join Date
    Oct 2009
    Posts
    16

    Default

    How do you add more than 1 Prefix?

    I've taken Brian's code and it works great for single prefixes and I'm currently using vBulletin 4.1.7 so this has managed to work through the 4 series of vBa and vB...

    I just can't figure out how to add more than 1 Prefix.

    I've tried..

    Code:
    AND thread.prefixid = 'X','X2'
    that produces a page error.

    I've tried

    Code:
    AND thread.prefixid = 'X,X2'
    and the entire news portal disappears from my page. The same with

    Code:
    AND thread.prefixid = 'X''X2'
    Any ideas?

  19. #39
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,466

    Default

    AND thread.prefixid IN('X','X2')
    Frequently Asked Questions
    CMPS Users Manual

    For vBadvanced software assistance, please use the support forums.
    Unsolicted PMs, IMs, and email will not be responded to.
    If you have a non-software related question or problem with your account, please submit a support ticket.

  20. #40
    Join Date
    Oct 2009
    Posts
    16

    Default

    Quote Originally Posted by Brian View Post
    AND thread.prefixid IN('X','X2')
    Thanks!

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Possibilities of filtering news by THREAD PREFIX
    By JohnBee in forum Module & Modification Discussion & Requests
    Replies: 0
    Last Post: 09-14-2007, 07:59 AM
  2. Thread title in news module
    By powerful_rogue in forum "How Do I..." Questions
    Replies: 1
    Last Post: 07-30-2007, 11:28 AM
  3. News Module thread length issue
    By sublimevb in forum "How Do I..." Questions
    Replies: 2
    Last Post: 08-19-2006, 07:45 AM
  4. News Module - Thread Title Question
    By blkatt in forum Troubleshooting / "How do I..." Questions
    Replies: 12
    Last Post: 09-20-2005, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •