Warning: The author of this contribution does not provide support for it anymore.

Posts Per Page

Topic Per Page | Companion Mod Here - Posts Per Page

Topic Per Page | Companion Mod Here

by PiperB » Fri Jun 30, 2017 7:46 am

I really wanted this to have the topic per page as well as post per page so I made a companion for this.

Topics Per Page Mod!

Edits Begin Now...3..2..1 Blast off!!

Open: search.php

Find:

Code: Select all

$search_forum	= request_var('fid', array(0));
Add After: (On a new blank line)

Code: Select all

$config['topics_per_page'] = $user->data['user_topics_per_page'];
Save the file.

Open: viewforum.php

Find:

Code: Select all

$lastread_select = '';
Add After: (On a new blank line)

Code: Select all

$config['topics_per_page'] = $user->data['user_topics_per_page'];
Find:

Code: Select all

$lastread_select .= ', fw.notify_status';
Add After: (On a new blank line)

Code: Select all

			//Begin Topics Per Page Mod
			$config['topics_per_page'] = $user->data['user_topics_per_page'];
			//End Topics Per Page Mod
Save the file.

Open: viewtopic.php

Find:

Code: Select all

$update		= request_var('update', false);
Add After: (On a new blank line)

Code: Select all

$config['topics_per_page'] = $user->data['user_topics_per_page'];
Save the File.

Open: adm/style/acp_users_prefs.html

Find:

Code: Select all

	<dl> 
		<dt><label>{L_VIEW_TOPICS_DIR}:</label></dt>
		<dd>{S_TOPIC_SORT_DIR}</dd>
	</dl>
Add After: (On a new blank line)

Code: Select all

    <dl>
        <dt><label>{L_VIEW_TOPICS_PER_PAGE}:</label></dt>
        <dd><input type="text" id="topics_pp_ucp" name="topics_pp_ucp" size="3" maxlength="3" min="1" max="150" value="{S_TOPICS_PER_PAGE}" /></dd>
    </dl>
Save the File.

Open: includes/acp/acp_users.php

Find:

Code: Select all

					'topic_st'			=> request_var('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0),
Add After: (On a new blank line)

Code: Select all

			//Begin Topics Per Page Mod
			'topics_pp_ucp'      => request_var('topics_pp_ucp', ($user_row['user_topics_per_page']) ? $user_row['user_topics_per_page'] : 0),
			//End Topics Per Page Mod
Find:

Code: Select all

							'user_topic_show_days'	=> $data['topic_st'],
Add After: (On a new blank line)

Code: Select all

                	//Begin Topics Per Page Mod
                         'user_topics_per_page'    => $data['topics_pp_ucp'],
                    // End Topics Per Page Mod
Find:

Code: Select all

					'S_TOPIC_SORT_DIR'		=> $s_sort_topic_dir,
Add After: (On a new blank line)

Code: Select all

               	//Begin Topics Per Page Mod
               'S_TOPICS_PER_PAGE'      => $user_row['user_topics_per_page'],
               //End Topics Per Page Mod
Save the file.

Open: includes/mcp/mcp_forum.php

Find:

Code: Select all

	$topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : $config['topics_per_page'];
Add Before: (On a new blank line)

Code: Select all

   //Begin Topics Per Page Mod
   $config['topics_per_page'] = $user->data['user_topics_per_page'];
   // End Topics Per Page Mod
Save the File.

Open: includes/ucp/ucp_prefs.php

Find:

Code: Select all

					'topic_st'		=> request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0),
Add After: (On a new blank line)

Code: Select all

					'topics_pp'	=> request_var('topics_pp', (!empty($user->data['user_topics_per_page'])) ? $user->data['user_topics_per_page'] : 0),
Find:

Code: Select all

							'user_topic_show_days'	=> $data['topic_st'],
Add After: (On a new blank line)

Code: Select all

							'user_topics_per_page' => $data['topics_pp'],
Find:

Code: Select all

					'S_TOPIC_SORT_DIR'		=> $s_sort_topic_dir,
Add After: (On a new blank line)

Code: Select all

				    'S_TOPICS_PER_PAGE'		=> $user->data['user_topics_per_page'],
Save the File.

Open: language/en/ucp.php

Find:

Code: Select all

	'VIEW_TOPICS_KEY'			=> 'Display topics ordering by',
Add After: (On a new blank line)

Code: Select all

	'VIEW_TOPICS_PER_PAGE'	    => 'Topics per page',
Save the file.

//Prosilver

Open: styles/prosilver/template/ucp_prefs_view.html

Find:

Code: Select all

		<dl>
			<dt><label>{L_VIEW_TOPICS_DIR}:</label></dt>
			<dd>{S_TOPIC_SORT_DIR}</dd>
		</dl>
Add After: (On a new blank line)

Code: Select all

		<hr />
		<dl>
			<dt><label>{L_VIEW_TOPICS_PER_PAGE}:</label></dt>
			<dd><input type="text" id="topics_pp" name="topics_pp" size="3" maxlength="3" value="{S_TOPICS_PER_PAGE}" /></dd>
		</dl>
Save the File.

//Subsilver2

Find:

Code: Select all

<tr>
	<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DIR}:</b></td>
	<td class="row2">{S_TOPIC_SORT_DIR}</td>
</tr>
Add After: (On a new blank line)

Code: Select all

<tr>
   <td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_PER_PAGE}:</b></td>
   <td class="row2"><input type="text" id="topics_pp" name="topics_pp" size="2" value="{S_TOPICS_PER_PAGE}" /></td>
</tr>
Save the File.

SQL Query: (Run this query on your database via phpmyadmin or other method of your choosing)
Note: in the sql you can change the number 25 in the NOT NULL DEFAULT '25' part to which ever number you have your board default topics per page set to. Make sure if you change the number to what you want it at before you run the query, otherwise everyone's individual settings will be set to whatever the original query is. In case you accidentally run it before hand and want to change it board wide, you can drop the old entry and then re-run the query with the number you want everyone's settings to default to boardwide.

Code: Select all

ALTER TABLE phpbb_users ADD user_topics_per_page MEDIUMINT( 3 ) NOT NULL DEFAULT '25';
Clear your cache, then refresh your templates.

Da da da da Done! :D


Now for the screen shot story. Shown on X-Treme Purple, a subsilver2 based style.
Note: Click on images to view full size, better to open in a new tab by holding down the Ctrl button while clicking.

First we see here the default setting in my ucp.
ucp1.png

Then I changed my setting to 2 topics per page. (Ridiculous exaggeration of a number setting, I know)
ucp2.png

Here we have the forum view after the setting was changed from the default of 25, to a personal setting of the ridiculous 2. You see it reflects the setting changes properly.
forum.png

Now what happens when you do a search and set it to display topic results instead of post.
search.png

In the MCP
mcp.png

Last but not least, the ACP user prefs.
acp.png
Installed and tested on a fully modded phpbb3.0.10 without any issues.

;)



__________________________________
Disclaimer: I decided to share my edits, fixes, addons, companion mods, e.t.c. for "wiki" type purposes and for those out there like me who are on older versions of phpbb3 still. Also for those who still have or wanted this mod to have a new feature this is for you! :)
<!-- IF U_LOVE_NOTEPAD++ -->
[td class=statement]I Notepad++ ![/td]
<!-- ENDNEVER --> <!-- tee hee --> :P
Whoa ooo whoa ooo whoa I'm a Lady!
User avatar
PiperB
Registered User
Posts: 164
Joined: Mon Nov 07, 2016 6:54 pm


cron