Year based subscription access

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.
ams.jour
Posts: 21
Joined: Sun Jun 29, 2008 10:57 pm

Re: Year based subscription access

Postby ams.jour » Wed Aug 25, 2010 8:20 pm

Hi Micheal

Is your current "Year based subscription code" will work for OJS 2.3.2-1 OR next version OJS 2.3.3 ?

-AMS

michael
Posts: 409
Joined: Thu Mar 29, 2007 2:09 pm
Contact:

Re: Year based subscription access

Postby michael » Thu Aug 26, 2010 8:58 am

Hi AMS,

It should work in both versions (i.e. 2.3.x).

Cheers,
Michael

dcamp
Posts: 15
Joined: Wed Oct 27, 2010 3:05 pm

Re: Year based subscription access

Postby dcamp » Thu Dec 23, 2010 10:43 am

While the previously given code still appears to work fine when pasted into the latest version of OJS, for peace of mind I rebased it. Here are the modded functions in classes/issue/IssueAction.inc.php rebased against OJS 2.3.3-3:

Code: Select all

  function subscribedUser(&$journal, $issueId = null, $articleId = null) {
    $user =& Request::getUser();
    $subscriptionDao =& DAORegistry::getDAO('IndividualSubscriptionDAO');
    $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
    $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId, null, true);
    $result = false;
    if (isset($user) && isset($journal)) {
      if (IssueAction::allowedPrePublicationAccess($journal, $publishedArticle)) {
        $result = true;
      } else {
        if (isset($articleId)) {
          if (isset($publishedArticle)) {
            import('classes.subscription.SubscriptionDAO');
            $result = $subscriptionDao->isValidIndividualSubscription($user->getId(), $journal->getId(), SUBSCRIPTION_DATE_BOTH, $publishedArticle->getDatePublished());
          }
        } else if (isset($issueId)) {
          $issueDao =& DAORegistry::getDAO('IssueDAO');
          $issue =& $issueDao->getIssueById($issueId);
          if (isset($issue) && $issue->getPublished()) {
            import('classes.subscription.SubscriptionDAO');
            $result = $subscriptionDao->isValidIndividualSubscription($user->getId(), $journal->getId(), SUBSCRIPTION_DATE_BOTH, $issue->getDatePublished());
          }
        }
      }
    }
    HookRegistry::call('IssueAction::subscribedUser', array(&$journal, &$result));
    return $result;
  }

Code: Select all

  function subscribedDomain(&$journal, $issueId = null, $articleId = null) {
    $subscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
    $result = false;
    if (isset($journal)) {
      if (isset($articleId)) {
        $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
        $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId, null, true);
        if (isset($publishedArticle)) {
          import('classes.subscription.SubscriptionDAO');
          $result = $subscriptionDao->isValidInstitutionalSubscription(Request::getRemoteDomain(), Request::getRemoteAddr(), $journal->getId(), SUBSCRIPTION_DATE_BOTH, $publishedArticle->getDatePublished());
        }
      } else if (isset($issueId)) {
        $issueDao =& DAORegistry::getDAO('IssueDAO');
        $issue =& $issueDao->getIssueById($issueId);
        if (isset($issue) && $issue->getPublished()) {
          import('classes.subscription.SubscriptionDAO');
          $result = $subscriptionDao->isValidInstitutionalSubscription(Request::getRemoteDomain(), Request::getRemoteAddr(), $journal->getId(), SUBSCRIPTION_DATE_BOTH, $issue->getDatePublished());
        }
      }
    }
    HookRegistry::call('IssueAction::subscribedDomain', array(&$journal, &$result));
    return $result;
  }

ams.jour
Posts: 21
Joined: Sun Jun 29, 2008 10:57 pm

Re: Year based subscription access

Postby ams.jour » Thu Dec 23, 2010 11:22 pm

Thanks DECAMP,

It seems that people are using this utility, so I again request to OJS to to reconsider to incorate in next version of OJS.

-AMS

risehigh
Posts: 12
Joined: Fri Feb 04, 2011 11:38 pm

Re: Year based subscription access

Postby risehigh » Fri Feb 04, 2011 11:53 pm

Dear OJS Team

Can we use Michael's "Year based subscription access code" for OJS-2.3.4 ?

-Rise

risehigh
Posts: 12
Joined: Fri Feb 04, 2011 11:38 pm

Re: Year based subscription access

Postby risehigh » Mon Feb 07, 2011 8:58 pm

Hi OJS Team

The "Year based subscription code" will work for OJS 2.3.4 ?

-Rise

jaik_70
Posts: 42
Joined: Tue Jun 02, 2009 5:49 am

Re: Year based subscription access

Postby jaik_70 » Mon Feb 21, 2011 12:21 am

Yes, "Year based subscription code" is working fine for OJS 2.3.4.

jaik_70
Posts: 42
Joined: Tue Jun 02, 2009 5:49 am

Re: Year based subscription access

Postby jaik_70 » Mon May 14, 2012 9:41 pm

Dear Michael :mrgreen:

Can we use the Year based subscription access CODE for OJS 2.3.7 version ?

-Jaik

michael
Posts: 409
Joined: Thu Mar 29, 2007 2:09 pm
Contact:

Re: Year based subscription access

Postby michael » Wed May 16, 2012 8:16 am

Hi Jaik,

Yes, it should continue to work with OJS 2.3.7.

Cheers,
Michael

risehigh
Posts: 12
Joined: Fri Feb 04, 2011 11:38 pm

Re: Year based subscription access

Postby risehigh » Mon Jul 30, 2012 6:57 am

Dear Michael :mrgreen:
We are using the Year based subscription access CODE for OJS 2.3.7 .

Everything are fine.

But there are some minor problem when we Login as an "EDITOR" (or play editor role) for any modification or alloting the reviewer (or opening the back issue), we find " Internal Server Error 500"

Looking for your valuable solution.

-Rise

risehigh
Posts: 12
Joined: Fri Feb 04, 2011 11:38 pm

Re: Year based subscription access

Postby risehigh » Mon Jul 30, 2012 7:06 am

Again:

When we replaced the original "classes/issue/IssueAction.inc.php" then everything are OK.
And when we using the modified (with year base subscription code) "classes/issue/IssueAction.inc.php" then we find " Internal Server Error 500"

michael
Posts: 409
Joined: Thu Mar 29, 2007 2:09 pm
Contact:

Re: Year based subscription access

Postby michael » Mon Jul 30, 2012 6:44 pm

Hi Rise,

Assuming that you're making a copy of the original file and then adding the custom changes, please double-check that the ownership and file permissions are correct for the modified copy.

Cheers,
Michael

risehigh
Posts: 12
Joined: Fri Feb 04, 2011 11:38 pm

Re: Year based subscription access

Postby risehigh » Tue Jul 31, 2012 5:48 am

Dear Michael :mrgreen:

Thanks for reply.

I am in travel so I will come to you on Monday.

-Rise

risehigh
Posts: 12
Joined: Fri Feb 04, 2011 11:38 pm

Re: Year based subscription access

Postby risehigh » Mon Aug 06, 2012 8:36 pm

Dear Michael :mrgreen:

Your suggestions about " ownership and file permissions" working.
Thanks again for timely help.


-Rise

risehigh
Posts: 12
Joined: Fri Feb 04, 2011 11:38 pm

Re: Year based subscription access

Postby risehigh » Tue Feb 05, 2013 9:48 pm

Dear Michael :mrgreen: (OJS Team)

Is there any updates for OJS 2.4.1 regarding "Year based subscription access " ?

Or erlier one your given code will work for this.


-Rise


Return to “OJS Development”

Who is online

Users browsing this forum: No registered users and 2 guests