You are viewing the PKP Support Forum | PKP Home Wiki

Limiting access by country

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Limiting access by country

Postby ItsDan » Mon Jul 21, 2008 1:53 pm

I was wondering if someone could point me in the right direction for making an adjustment so that the payment module could require payments (likely per-article) for users in certain countries, and allow free access for user's in other countries. I'm proficient in PHP and have written an ip->country lookup scheme before, mainly I'm interested in learning if there's a relatively simple 'switch' I could tweak, or where specifically the logic is that determines if a link to a galley file leads to a payment page or the pdf directly.
Posts: 54
Joined: Wed Jun 13, 2007 8:55 am

Re: Limiting access by country

Postby jalperin » Tue Jul 22, 2008 8:46 am


The simplest thing I can think of is for you to do the following:

1) in SubscriptionDAO, add your new function (say, isValidSubscriptionByCountryIP) that checks if the IP comes from a country that does not have to pay. You can look at isValidSubscriptionByIP() in that same class for some ideas.
2) add another few lines in isValidSubscription() after the "if" for isValidSubscriptionByIP

That should pretty much do it, if you don't want/need some interfaces for configuring which countries you want to allow/disallow and you're happy doing it within this function.

I'd be very interesting in seeing the code you put together for this so that we may possibly add it as a Plugin or as a new feature in future versions of OJS.
Posts: 158
Joined: Thu Jul 06, 2006 1:03 pm
Location: Buenos Aires

Re: Limiting access by country

Postby ItsDan » Wed Jul 23, 2008 7:19 am

I'll be happy to post what I come up with. I'll likely make a configuration screen, but outside of OJS itself. I do think it would be a worthwhile feature. Our specific goal is to provide free access to people coming from registered libraries and 3rd world nations while still maintaining a fee system for 1st world countries.
Posts: 54
Joined: Wed Jun 13, 2007 8:55 am

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest