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
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

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