[ABD] Forum Based Posts Per Page

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
User avatar
RMcGirr83
Former Team Member
Posts: 21987
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

[ABD] Forum Based Posts Per Page

Post by RMcGirr83 »

Extension Name: Forum Posts Per Page
Author: RMcGirr83

Description:
Allows an admin of the forum to set the number of posts to display on a per forum basis. Active in viewforum, viewtopic, search (active_topics), forum display and MCP (topic_view).

Version: 1.0.0

Download: https://github.com/RMcGirr83/forumposts ... master.zip

Installation:
  1. Copy the entire contents of the repository to /ext/rmcgirr83/forumpostsperpage/
  2. Navigate in the ACP to Customise -> Extension Management -> Extensions.
  3. Click Enable.
Github Repository: https://github.com/RMcGirr83/forumpostsperpage
Last edited by RMcGirr83 on Tue Dec 06, 2016 8:28 pm, edited 2 times in total.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

Seems to work superbly! Cheers Rich. A much needed addition to my board. I'm sure others will find this useful!
Edit: And it should be in the core imo!
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
Tuqe
Registered User
Posts: 63
Joined: Mon Nov 10, 2014 9:18 am
Location: Turkey

Re: [RC] Forum Based Posts Per Page

Post by Tuqe »

I was active but didn't understand how it works.
Where to look?
:oops:
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

ACP > FORUMS > CHOOSE FORUM > EDIT FORUM >

Find:

Code: Select all

Forum Posts Per Page:
The number of posts to display in a topic for this forum. If set to 0, the setting will be ignored.
Adjust the number. It will show that many 'Posts per page' in that forum.
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

Rich, just noticed an issue.

When I search for 'Active topics' or My posts (Possibly more of the searches) I'm seeing topics that have more pages than they actually do. For example, a topic shows in the search results as having two pages. (Incorrect)

But it only has/should have one (As the posts per page is at default setting) for that forum.

Real Example: http://www.corradog60.com/search.php?se ... ive_topics

See the topic titled 'Love the new forum'? It's showing as having two pages, but if you visit it via the title link, it only has one page (10 posts).

There's a topic further down which has the setting at 5 posts per page (Christine - Tornado red 16v), that is showing 3 pages, which is correct. So it seems to be an issue with the default forums?
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
User avatar
RMcGirr83
Former Team Member
Posts: 21987
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 »

I was afraid that might happen. Issue is that the setting for $config['posts_per_page'] is being used when using the search. It is using the setting for the Corrado VR6 8V 16V Gallery forum for all forums that are displaying. Once "Hello everyone" goes above 4 posts I think you will find the same with that one as well and there isn't a whole lot that can be done about that without modifying the core code which I am trying to avoid.

This is part of the reason that the setting should be in core. If it were me I would remove it from the search part of the forum.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

Damn. Hmmm. Can you suggest a core edit for the search Rich? Or if not, how to remove it from search? Or :roll: :lol: do you think there may be a way for the extension to work somehow (Either currently or in the near future?)

Works great apart from this niggle.
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
User avatar
RMcGirr83
Former Team Member
Posts: 21987
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 »

Try this for the listener file

https://github.com/RMcGirr83/forumposts ... stener.php

and if it still doesn't work comment out this line in the same file

Code: Select all

			'core.search_modify_tpl_ary'				=> 'search_modify_tpl_ary',
in other words make it like this

Code: Select all

			/*'core.search_modify_tpl_ary'				=> 'search_modify_tpl_ary',*/
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

Hi Rich, tried the new listener.php file and it didn't work unfortunately. Topics with a real 1 page, were showing with two pages in search results.

I've commented out that line, and now the pagination is sort of default as expected.

Just a thought...But for the forums that I haven't set any value for 'Posts per page', should I try adding the default '10' in those forums? Would that work?
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
User avatar
RMcGirr83
Former Team Member
Posts: 21987
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 »

Last try, find this in the listener file

Code: Select all

    // modify and reset on search
    public function search_modify_tpl_ary($event)
    {
        if ($event['show_results'] == 'topics')
        {
            $forum_id = $event['row']['forum_id'];
            $posts_per_page = $this->get_forum_data($forum_id);
            if (!empty($posts_per_page))
            {
                $this->posts_per_page($posts_per_page);
            }
        }
    }
and change it to this

Code: Select all

    // modify and reset on search
    public function search_modify_tpl_ary($event)
    {
        if ($event['show_results'] == 'topics')
        {
            $array = $event['row'];
            $array['forum_posts_per_page'] = $this->get_forum_data($event['row']['forum_id']);
            $event['row'] = $array;
        }
    }
then find this line in search.php file

Code: Select all

                $pagination->generate_template_pagination($view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
and before it add

Code: Select all

                $config['posts_per_page'] = !empty($row['forum_posts_per_page']) ? $row['forum_posts_per_page'] : $config['posts_per_page'];
that's about all I can think of at the moment and looks like it will require an edit to the core file which is not optimal.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

No joy Rich.

But! I just went through all my forums, and for the 'Posts per page' setting, I replaced the '0' with '10' apart from a few forums where I set it to '5'. And I'm pretty sure that's cracked it? Unless I'm missing something?

So if all's well there, can your extension maybe set '10' as default for the forum_posts_per_page table instead of '0' ?
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
User avatar
RMcGirr83
Former Team Member
Posts: 21987
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 »

I can see no reason as to why that wouldn't work. If you like, please PM me an account in use on your forum as well as FTP access so I can try and debug this.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

Cheers for the help Rich, but I've deleted my forum.
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
User avatar
RMcGirr83
Former Team Member
Posts: 21987
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 »

:lol: wow
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil »

Back up after having a word with myself and calming down. :D Anyway, now that the 'Posts per page' setting for every single forum has either '5' or '10' everything seems to work, including in search results etc.

Only slight thing is the issue relative to the extension 'Detailed viewonline' but I'll see if the author can come up with something.

Thanks again for this.
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
Post Reply

Return to “Abandoned Extensions”