phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Different number of posts per page for guests and members.


 
Search this topic... | Search MOD Requests... | Search Box
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Author Message
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Sun Oct 02, 2011 9:01 pm 
Post subject: Different number of posts per page for guests and members.

Hi,

I would like to be able to show a different number of posts per page to guests than to logged in users.

Is this difficult to achieve, can anyone point me in the right direction?

Thanks.

_________________
phpBB2 will never die, I hope!
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 417
Location: Québec


flag
PostPosted: Sun Oct 02, 2011 11:48 pm 
Post subject: Re: Different number of posts per page for guests and member

I think it would only affect viewtopic.php and viewforum.php, and could be as simple as adding this somewhere after the includes of each file:

Code:
if ($userdata['user_level'] == ANONYMOUS) { $board_config['posts_per_page'] = YOUR_NUMBER_HERE;}


I haven't tested it, though, I could very well be overlooking some things.
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Mon Oct 03, 2011 7:20 am 
Post subject: Re: Different number of posts per page for guests and member

It works, somehow,

But oddly enough in the following manner:

If I place
Code:
if ($userdata['user_level'] == ANONYMOUS) { $board_config['posts_per_page'] = 25;}
right behind the includes in viewtopic.php the admin settings are not overriden, neither for logged in nor for guests.

However, if I use
Code:
if ($userdata['user_level'] != ANONYMOUS) { $board_config['posts_per_page'] = 25;}
the admin settings are overridden, but unfortunately, for both logged in and guests.

icon_cry.gif

_________________
phpBB2 will never die, I hope!
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Tue Oct 04, 2011 6:55 am 
Post subject: Re: Different number of posts per page for guests and member

It appears as if I fixed this.

Instead of user_level I use logged in status.

Placing
Code:
//
// Start posts per page for logged in users
//
if ($userdata['session_logged_in']) { $board_config['posts_per_page'] = 25;}
//
// End posts per page for logged in users
//
right after the session management works fine.

I made the same change to search.php.

This seems to have covered everything. icon_biggrin.gif

Thank you for your attention, Salvatos. icon_wink.gif

_________________
phpBB2 will never die, I hope!
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 417
Location: Québec


flag
PostPosted: Tue Oct 04, 2011 9:34 am 
Post subject: Re: Different number of posts per page for guests and member

That makes sense icon_smile.gif I'm glad you figured it out, your other post wasn't showing as unread so you'd have waited for me a long time icon_wink.gif
Back to top
Jim_UK
Board Member



Joined: 19 Nov 2008

Posts: 544
Location: North West UK


flag
PostPosted: Tue Oct 04, 2011 9:37 am 
Post subject: Re: Different number of posts per page for guests and member

Ok - Curiosity has got the better of me.
Why would you want "Guests" to be able to see a different number of pages than logged in users?

Jim
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Tue Oct 04, 2011 9:48 am 
Post subject: Re: Different number of posts per page for guests and member

@Salvatos: Now I'm even happier that I tried and managed to fix this.
Thanks for your pointing in the right direction, you were pretty close.

@Jim: I do this because I show adsense ads to guests only, logged in users don´t see them.
In an attempt to achieve a higher click-through-rate I reduced the number of posts per page which makes more ads show up.

I wanted to have a higher number of posts for logged in visitors so that they don´t have to click through a lot of pages in larger topics.

_________________
phpBB2 will never die, I hope!
Back to top
Jim_UK
Board Member



Joined: 19 Nov 2008

Posts: 544
Location: North West UK


flag
PostPosted: Tue Oct 04, 2011 9:58 am 
Post subject: Re: Different number of posts per page for guests and member

Quote:
I do this because I show adsense ads to guests only, logged in users don´t see them.
In an attempt to achieve a higher click-through-rate I reduced the number of posts per page which makes more ads show up.


Yes I see the reasoning now. My users see the adsense but very few click them. Some of them objected when I added the adsense. My users are very generous though and donations cover the cost of our server.($109.95/month)
I had thought about removing the adsense as it generates only about $50/year.

Jim
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Tue Oct 04, 2011 10:13 am 
Post subject: Re: Different number of posts per page for guests and member

I did notice a slight improvement in CTR after I reduced the number of posts per page.

But I wanted to get rid if the inconvenience for logged in users.

Nevertheless, compared to the rest of my site the income generated by adsense by the forum is lower. I consider the forum income as a small extra that helps raise the overall adsense income.

The best performing ad on the forum is the ad I placed in a welcome block in the header shown in the forum- and topicview. The index view doesn´t show that block.

I'm afraid I wouldn´t make a lot of mine if I had to depend on donations. But even if I did I don´t think I would remove adsense though. I believe I do enough by showing ads only to guests.

Do you really spend a hundred + dollars a month on your server?
That sounds very expensive.
I have a great virtual server package with a German hosting company that costs me only 18 euros a month.

_________________
phpBB2 will never die, I hope!
Back to top
Jim_UK
Board Member



Joined: 19 Nov 2008

Posts: 544
Location: North West UK


flag
PostPosted: Tue Oct 04, 2011 10:25 am 
Post subject: Re: Different number of posts per page for guests and member

We had a few hosting packages before the one we are on now.
It was ok on shared hosting when we started up but we soon reached the "excessive resources" email from the host. We moved host and went for a VPS but as they are still shared resources we once again maxed out.
A move to a new host made little difference so we have finally moved to a Managed VPS that is on it's own Node. We share no resources so any excessive loads only affect ourselves.
Hosts are great and can't do enough for us.
Pricey yes but peace of mind. We had got tired of moving the account(s) around.

Jim
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Tue Oct 04, 2011 10:45 am 
Post subject: Re: Different number of posts per page for guests and member

It's great to be at ease when it comes to hosting.

I have moved a few times and know how much work it is to set things up again on a new server.

My hosting company offers managed VPS from 15 up to 45 euros a month, vat included. If you're interested you can see them here. The site is in German but you can write them in English if you wish.

I am very happy with them, it's a very serious company.

Anyhow, it's nice readin' and writing you,

Greetings.

_________________
phpBB2 will never die, I hope!
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0150 seconds using 15 queries. (SQL 0.0030 Parse 0.0004 Other 0.0116)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo