vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Forum Display Enhancements - All Topic - Master Forums - Shows threads from multiple forums in one forum (https://vborg.vbsupport.ru/showthread.php?t=245839)

Alan_SP 04-20-2011 12:14 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2186503)
As for usergroup permissions, users will see the thread title for every thread in every forum, but they will get a permission denied error if they try to view a thread from a forum they don't have permission to view.

Thank you for adding option to include all forums, but this is a bit of a problem, because I don't want users to know for threads in special forums, like moderators' and admins' forums. Could you code some kind of operator that would say that I want mentioned forums excluded from all forums?

I have over 300 forums, and I need to exclude just few of them and want every other included in master forum (some kind of making it What's new forum). Is it possible?

EDIT: If you could program it to respect usergroup permissions, it would be excellent.

BirdOPrey5 04-20-2011 01:16 PM

I have no plans to have it respect usergroup permissions for thread titles at this time. I really don't even know how to start that and more importantly, it's not a feature I conceivably would ever need myself.

However to specify just forums to exclude is an easy change.

In the TWO plugins, All Topic Forumdisplay Thread Count and All Topic Forumdisplay Threadid change the line:
PHP Code:

     $hook_query_where "*/ WHERE forumid IN ($alltopics) AND sticky = 0 $prefix_filter $visiblethreads $globalignore $limitothers $datecut"

to

PHP Code:

     $hook_query_where "*/ WHERE forumid NOT IN ($alltopics) AND sticky = 0 $prefix_filter $visiblethreads $globalignore $limitothers $datecut"

Basically adding the word "NOT" to the code.

Now when you specify a master forum the numbers after it will be EXCLUDED instead of INCLUDED in the master forum,
for example:
Code:

2|11,20,58
Will make 2 a master forum that includes threads from EVERY forum except 11, 20, and 58.

Alan_SP 04-20-2011 02:13 PM

Excellent. Just to ask you, if I want to make this available in one mod, but with both including and excluding forums. how can this be made? So I could make some master forums that include forums, and have some that exclude certain forums?

Or it should be made with two mods, based on the same code, but different plugins' names? In case of two mods, could variable names be the same, just plugin names different?

Alan_SP 04-20-2011 02:31 PM

For example, if it could be used + or - sign for including, or excluding forums instead having | sign.

So we would have something like this:

5+5,3,6,7,8
10-5,3,6,7,8

In this example forum 5 would show 5,3,6,7 and 8 forums and forum 10 would show every other forum. It would be great, and this way everything would be covered, even usergruop permissions we could manually control without problems.

BirdOPrey5 04-20-2011 02:57 PM

As it's programmed now you can either include forums or exclude forums, you can't do both. Also making a copy of the mod probably wouldn't work either because they will both try to use the same hooks at the same time.

I will only support the mod as it is written. You are free to customize it if you understand PHP and MySQL but I can't/won't support those changes.

Alan_SP 04-20-2011 03:19 PM

I don't understand it very well, but I'm looking at variables.

I think if I rename variables (not to conflict them) I probably could make this in two mods, one for including and one for excluding mods.

This is what I would rename:

alltopic_enable
alltopic_master
alltopics
alltop
masters
assforums

I think that just adding e in front of this variables (seraching and replacing) would make this two two mods (including and excluding) different enough. Do you think it is enough?

BirdOPrey5 04-20-2011 03:26 PM

As I said above I don't think it will work because two mods are still going to need to try and access the same hook at the same time.

But as I also said, feel free to experiment.

Alan_SP 04-20-2011 03:38 PM

Well, I'll try and see if it could work on my test site. If it works, I'll post here. :)

Alan_SP 04-21-2011 07:40 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2186651)
However to specify just forums to exclude is an easy change.

In the TWO plugins, All Topic Forumdisplay Thread Count and All Topic Forumdisplay Threadid change the line:
PHP Code:

     $hook_query_where "*/ WHERE forumid IN ($alltopics) AND sticky = 0 $prefix_filter $visiblethreads $globalignore $limitothers $datecut"

to

PHP Code:

     $hook_query_where "*/ WHERE forumid NOT IN ($alltopics) AND sticky = 0 $prefix_filter $visiblethreads $globalignore $limitothers $datecut"

Basically adding the word "NOT" to the code.

I just tried to modify mod to enable both including and excluding type of master forums, but I found out the main problem at the moment is in this code. For some reason, when I have this NOT added, every forum becomes Master forum showing all threads. Not only specified, but every.

Do you maybe know how to make excluding type of Master forum?

BirdOPrey5 04-21-2011 11:57 PM

1 Attachment(s)
Yeah I see now it was more work than just changing the word to "NOT".

I am uploading a working "reversed" all topic in this post. In this version of All Topic you exclude forums from the master forum only. Forums not mentioned in all-topic settings work as normal.

Edited- Removed debug output from product file.

Alan_SP 04-22-2011 06:38 AM

1 Attachment(s)
Yes, that's it. :up:

Now it works excellent. I merged both options (for including and excluding), removed your debugging info (appeared on top of page in excluding forums), removed option for including all forums in excluding part and I hope that everything will work as intended. :)

I tested it on my server and now everything works as far as I can tell. I had strange bug, but really strange bug when sometimes excluding forums became including ones after reinstall and where reinstalling product again helped. :eek: I'm not sure why, but I changed plugin execution order for excluding forums plugins to 6 and tried 3 times to reinstall mod and it worked all 3 times fine. If someone would have problems, just try to reinstall.

I attached modified version and BirdOPrey5 I hope you'll to use it too (and support it). :) This is really excellent mod. :up:

Only suggestion is if names of forums in threadbit could become links to these forums? This may be very useful, especially if users would like to open new threads in appropriate forums.

Cybertims 04-22-2011 07:25 AM

Database error in vBulletin 4.1.3 Beta 1:

Invalid SQL:

SELECT COUNT(*) AS threads,
(
SELECT COUNT(*) AS newthread
FROM thread AS thread
WHERE forumid = 12
AND lastpost > 1303460427
AND open <> 10
AND sticky = 0

AND visible IN (0,1,2)



*/ WHERE forumid > 0 AND sticky = 0 AND visible IN (0,1,2)
) AS newthread

FROM thread AS thread

/*
WHERE forumid = 12
AND sticky = 0

AND visible IN (0,1,2)



*/ WHERE forumid > 0 AND sticky = 0 AND visible IN (0,1,2);

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/ WHERE forumid > 0 AND sticky = 0 AND visible IN (0,1,2)
) AS newthre' at line 14
Error Number : 1064
Request Date : Friday, April 22nd 2011 @ 10:21:32 AM
Error Date : Friday, April 22nd 2011 @ 10:21:32 AM
Script : *****/forumdisplay.php/12-Master-Forum
Referrer : ******/index.php
IP Address : *****
Username : ****
Classname : vB_Database
MySQL Version : 5.0.91-log

I continually get this error above as soon as I turn on the product. I have created a forum called master forum which has ID of 12, I add 12|* and always get the above error when trying to view the new forum section.

Cheers

BirdOPrey5 04-22-2011 10:13 AM

Oh, the Master Forum needs at least 1 normal thread in it for this to work. Make a new thread before enabling the product.

Cybertims 04-22-2011 01:08 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2187341)
Oh, the Master Forum needs at least 1 normal thread in it for this to work. Make a new thread before enabling the product.

It does have 1 normal thread in it already.

BirdOPrey5 04-22-2011 01:43 PM

It looks like maybe you didn't make the file edit as explained in the instructions.

You must edit forumdisplay.php, find the code below and delete the line in red and then save and re-upload the file.

Code:

        ($hook = vBulletinHook::fetch_hook('forumdisplay_query_threadscount')) ? eval($hook) : false;

        # Include visible IN (0,1,2) in order to hit upon the 4 column index
        $threadscount = $db->query_first_slave("
          SELECT COUNT(*) AS threads,
          (
          SELECT COUNT(*) AS newthread
          FROM " . TABLE_PREFIX . "thread AS thread
          WHERE forumid = $foruminfo[forumid]
            AND lastpost > $lastread
            AND open <> 10
            AND sticky = 0
            $prefix_filter
            $visiblethreads
            $globalignore
            $limitothers
            $datecut
            $hook_query_where       
          ) AS newthread
                $hook_query_fields
                FROM " . TABLE_PREFIX . "thread AS thread
                $tachyjoin
                $hook_query_joins
                WHERE forumid = $foruminfo[forumid]
                        AND sticky = 0
                        $prefix_filter
                        $visiblethreads
                        $globalignore
                        $limitothers
                        $datecut
                        $hook_query_where
        ");
        $totalthreads = $threadscount['threads'];
        $newthreads = $threadscount['newthread'];


Alan_SP 04-22-2011 10:30 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2187341)
Oh, the Master Forum needs at least 1 normal thread in it for this to work. Make a new thread before enabling the product.

When I tested merging including and excluding options I used only empty forums for Master forums. And it worked without any problems (well, with new code for excluding it does). So I think that you don't have to have any threads in Master forums.

Only problem is you don't see on forum display (index page) that Master forums has any threads. They show only their own threads. At least it looks like that for me...

BirdOPrey5 04-23-2011 11:01 AM

Quote:

Originally Posted by Alan_SP (Post 2187565)
When I tested merging including and excluding options I used only empty forums for Master forums. And it worked without any problems (well, with new code for excluding it does). So I think that you don't have to have any threads in Master forums.

Only problem is you don't see on forum display (index page) that Master forums has any threads. They show only their own threads. At least it looks like that for me...

That is true, forumdisplay won't show threads from the slave forums, only the master. I have no plans to changing this anytime soon, it would require more plugins and probably more file edits.

Alan_SP 04-23-2011 06:45 PM

This is not problem for me. :) I'll write in forum description that there's no information about actual Master forums content and that they look inside themselves.

Master forums are excellent idea and very useful. :up:

BirdOPrey5 04-23-2011 07:04 PM

Noted that for some reason vBulletin used a different version of forumdiplay.php on VB 4.0.7. You DO NOT need to do the manual file edit on 4.0.7, it will just work. I know you MUST do the file edit on 4.0.8 and above and 4.0.4, not sure about 4.0.5/6.

vbandroid 06-04-2011 07:43 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2187718)
That is true, forumdisplay won't show threads from the slave forums, only the master. I have no plans to changing this anytime soon, it would require more plugins and probably more file edits.

This is a great mod! Thanks. I was wondering if its possible to have some sort of work around for this? perhaps add a condition code to the master board, like if forum id=X, then pull stats from a,b,c. That we can manually add. I'm not very good at this but would this be possible?

vbandroid 06-04-2011 09:39 PM

also this doesn't import stick threads from the slave forums, is their a way around this?

BirdOPrey5 06-04-2011 10:27 PM

Quote:

Originally Posted by vbandroid (Post 2203563)
This is a great mod! Thanks. I was wondering if its possible to have some sort of work around for this? perhaps add a condition code to the master board, like if forum id=X, then pull stats from a,b,c. That we can manually add. I'm not very good at this but would this be possible?

No, not going to happen with this mod unfortunately.

Quote:

Originally Posted by vbandroid (Post 2203596)
also this doesn't import stick threads from the slave forums, is their a way around this?

This on the other hand is possible... In fact the first time I did this mod I had it show slave stickies too but then people didn't like all the stickies being shown so I took them out.

I will work on adding an option so you can choose to work with stickies or not.

Alan_SP 06-05-2011 12:05 AM

About sticky threads, if you can make them normal (not sticky) in master forum? Is it possible?

BirdOPrey5 06-05-2011 12:38 AM

Quote:

Originally Posted by Alan_SP (Post 2203626)
About sticky threads, if you can make them normal (not sticky) in master forum? Is it possible?

Interesting proposal... I will have to research this.

vbandroid 06-05-2011 04:02 PM

Thanks for getting back to us bird of prey, again fantastic mod.

BirdOPrey5 06-06-2011 12:43 AM

Updated to 2.2. You can now choose whether to show stickies from slave forums or not. If yes they will also be sticky threads in your master forum. I wasn't able to implement the suggestion to show them as normal threads- will keep trying for that though.

Nik S 06-07-2011 03:15 AM

I really like this mod. Thanks!

Would it be possible for threads in the master forum to link to their sub forums?

BirdOPrey5 06-07-2011 09:16 AM

Quote:

Originally Posted by Nik S (Post 2204485)
I really like this mod. Thanks!

Would it be possible for threads in the master forum to link to their sub forums?

Are you talking about where it gives the name of the forum the thread is really in? Yes that can be done... I will make it an option in the next version but in the mean time if you want to do this do the following:

Got to Admin CP -> Plugin Manager
Edit the All Topic in Threadbit Plugin
Erase all the PHP code and replace it with the following:

Code:

if ($vbulletin->options['alltopic_enable'] AND $vbulletin->options['alltopic_tempen'])
{
  require_once(DIR . '/includes/adminfunctions_template.php');

  $find = trim(preg_replace('#^\$final_rendered = \'(.*)\';$#s', '\\1', compile_template('{vb:rawphrase started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, \'postuserid\', \'postusername\'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}')));

if ($vbulletin->options['alltopic_ss'])
 {

  $replace = trim(preg_replace('#^\$final_rendered = \'(.*)\';$#s', '\\1', compile_template('{vb:rawphrase started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, \'postuserid\', \'postusername\'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}<vb:if condition="($thread[\'forumid\'] != $forbopid)">&nbsp;-&nbsp;<a href="forumdisplay.php?f={vb:raw thread.forumid}">{vb:raw thread.forumtitle}</a></vb:if>')));
 }
else
 {
  $replace = trim(preg_replace('#^\$final_rendered = \'(.*)\';$#s', '\\1', compile_template('{vb:rawphrase started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, \'postuserid\', \'postusername\'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}<vb:if condition="!$thread[\'sticky\'] AND ($thread[\'forumid\'] != $forbopid)">&nbsp;-&nbsp;<a href="forumdisplay.php?f={vb:raw thread.forumid}">{vb:raw thread.forumtitle}</a></vb:if>')));
 }
  $vbulletin->templatecache['threadbit'] = str_replace($find, $replace, $vbulletin->templatecache['threadbit']);
}

Save the Plugin.

Forum names will now be linked. :)

Gripi 06-07-2011 10:38 AM

installed.. thanks alot for this great mod

Alan_SP 06-07-2011 02:31 PM

1 Attachment(s)
Excellent, this linking to forum names. :up:

I added this change to combined including and excluding master forums (attached).

BirdOPray5, if you manage to make sticky threads into normal threads, please also do excluding variant of this mod.

Nik S 06-16-2011 04:44 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2204547)
Forum names will now be linked. :)

Works great, thanks! :up:

8thos 06-18-2011 04:11 AM

Wow...

8thos 06-18-2011 05:23 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2186502)
Version 2.1 Released

Full instructions in .zip file...

But basically there is now a required manual file edit- there is no way around this in order to get the thread count correct for master forums.

As Jennifer2010 pointed out the master forum would only count as many threads as were originally in the forum. This is especially an issue when the master forum contains very few threads and the slave forums contain many more threads. No page numbers (or not enough) will be produced.

The fix requires deleting 1 line from your forumdisplay.php file.

At approximately line 761 you will find this code:
PHP Code:

    ($hook vBulletinHook::fetch_hook('forumdisplay_query_threadscount')) ? eval($hook) : false;

    
# Include visible IN (0,1,2) in order to hit upon the 4 column index
    
$threadscount $db->query_first_slave("
      SELECT COUNT(*) AS threads,
      (
       SELECT COUNT(*) AS newthread
       FROM " 
TABLE_PREFIX "thread AS thread
       WHERE forumid = 
$foruminfo[forumid]
        AND lastpost > 
$lastread
        AND open <> 10
        AND sticky = 0
        
$prefix_filter
        
$visiblethreads
        
$globalignore
        
$limitothers
        
$datecut
        
$hook_query_where     
      ) AS newthread
        
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
        WHERE forumid = 
$foruminfo[forumid]
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where
    "
);
    
$totalthreads $threadscount['threads'];
    
$newthreads $threadscount['newthread']; 

You must delete the 1st instance of: $hook_query_where

So your final code should look like:
PHP Code:

    ($hook vBulletinHook::fetch_hook('forumdisplay_query_threadscount')) ? eval($hook) : false;

    
# Include visible IN (0,1,2) in order to hit upon the 4 column index
    
$threadscount $db->query_first_slave("
      SELECT COUNT(*) AS threads,
      (
       SELECT COUNT(*) AS newthread
       FROM " 
TABLE_PREFIX "thread AS thread
       WHERE forumid = 
$foruminfo[forumid]
        AND lastpost > 
$lastread
        AND open <> 10
        AND sticky = 0
        
$prefix_filter
        
$visiblethreads
        
$globalignore
        
$limitothers
        
$datecut
 
      ) AS newthread
        
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
        WHERE forumid = 
$foruminfo[forumid]
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where
    "
);
    
$totalthreads $threadscount['threads'];
    
$newthreads $threadscount['newthread']; 

Save the file and replace your forumdisplay.php file with this one.

Then import/install the new product .xml file version 2.1.

NOTE- You MUST DELETE the entire line, you cannot "comment it out."

Also New in 2.1

You can now use an * to specify "ALL" forums be included in your master forum, such as:
Code:

2|*
Would make a master forum in forum id #2 that contains threads from EVERY forum on your site.

I am running vb4.1.4. This edit killed my forum display. I added the code back and it's fine.

Is there something different with 4.1.4 that's preventing this modification from working?

8thos 06-18-2011 05:46 AM

Okay nevermind, that was because I used Alan SP's version.

I disabled and uninstalled his version.

I used the one in the first post. Running fine now.

kkk333 07-05-2011 09:13 PM

thank you for this amazing mod
but does it cause extra queries ? extra load ? because I want use it in big forum

BirdOPrey5 07-06-2011 12:40 AM

There are no extra queries- it modifies an existing query. There shouldn't be any noticeable extra load.

vbandroid 07-09-2011 02:29 PM

Hey BirdOfPrey, any update on whether you can use prefix instead of forum id to pull threads from forums? or only to a certain prefix from the specified forums?

BirdOPrey5 07-09-2011 11:55 PM

Quote:

Originally Posted by vbandroid (Post 2218521)
Hey BirdOfPrey, any update on whether you can use prefix instead of forum id to pull threads from forums? or only to a certain prefix from the specified forums?

The more I think about it the less I think I could or should integrate that into this mod. It might be possible as a separate mod but not a priority right now.

NovoCiv 07-20-2011 02:53 PM

I'm on 4.0.5 still and the forumdisplay.php edit isn't possible. The original appears as:
Code:

        ($hook = vBulletinHook::fetch_hook('forumdisplay_query_threadscount')) ? eval($hook) : false;

        # Include visible IN (0,1,2) in order to hit upon the 4 column index
        $threadscount = $db->query_first_slave("
                SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > $lastread AND open <> 10, 1, 0)) AS newthread
                $hook_query_fields
                FROM " . TABLE_PREFIX . "thread AS thread
                $tachyjoin
                $hook_query_joins
                WHERE forumid = $foruminfo[forumid]
                        AND sticky = 0
                        $prefix_filter
                        $visiblethreads
                        $globalignore
                        $limitothers
                        $datecut
                        $hook_query_where
        ");
        $totalthreads = $threadscount['threads'];
        $newthreads = $threadscount['newthread'];

Removing the $hook_query_where causes database errors. I tried replacing the entire section with the "this is what your code should look like" and the forums run fine until I enable the product. When enabled, it causes this error on forumdisplay:

Quote:

vBulletin Message
Unable to add cookies, header already sent.
File: /home/novoci5/public_html/forums/vb/exception/templatefatalerror.php
Line: 67
Is there a way to make this work without upgrading?

BirdOPrey5 07-20-2011 04:06 PM

In 4.0.5 try just using the original forumdisplay.php without any edits at all.


All times are GMT. The time now is 01:24 PM.

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.01661 seconds
  • Memory Usage 1,897KB
  • 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
  • (5)bbcode_code_printable
  • (6)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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