[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
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

[ABD] Forum Based Posts Per Page

Post by RMcGirr83 » Thu Nov 27, 2014 1:58 pm

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.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Thu Nov 27, 2014 8:42 pm

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 Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | 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 » Thu Nov 27, 2014 9:04 pm

I was active but didn't understand how it works.
Where to look?
:oops:

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Thu Nov 27, 2014 9:34 pm

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 Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Thu Dec 04, 2014 1:31 pm

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 Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 » Fri Dec 05, 2014 2:40 am

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.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Sat Dec 06, 2014 9:14 pm

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 Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 » Sun Dec 07, 2014 11:16 am

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',*/
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Sun Dec 07, 2014 4:20 pm

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 Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 » Sun Dec 07, 2014 6:40 pm

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.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Sun Dec 07, 2014 9:48 pm

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 Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 » Mon Dec 08, 2014 12:02 pm

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.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Mon Dec 08, 2014 10:42 pm

Cheers for the help Rich, but I've deleted my forum.
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [RC] Forum Based Posts Per Page

Post by RMcGirr83 » Tue Dec 09, 2014 10:14 am

:lol: wow
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [RC] Forum Based Posts Per Page

Post by Volksdevil » Thu Dec 11, 2014 3:07 am

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 Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

Post Reply

Return to “Abandoned Extensions”