OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Link to article page fails to redirect to login in 2.4.0

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

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

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Link to article page fails to redirect to login in 2.4.0

Postby aleskl » Fri Sep 21, 2012 6:13 am

Dear OJS developers!

We just upgraded our OJS installation from 2.3.6 to 2.4.0. One of our users (author of a submitted article that is being reviewed) just noticed that when she clicked on a direct link to the article review page did not do anything, if she was not logged in. The link was .../author/submissionReview/937. In previous version, such a direct link would redirect to the login page, if user was not logged in.

I have checked the server error log and found this:
PHP Fatal error: Call to a member function getId() on a non-object in /var/www/html/ojs/pages/author/AuthorHandler.inc.php on line 135

I looked at the above file and found this line in the function validate:
Code: Select all
if ($authorSubmission->getUserId() != $user->getId()) {

but I don't have a clue why it fails. If I remember correctly the getId() function was introduced in 2.4.0, so maybe it's not called correctly here.

However, I then tried to revert the function validate in the /pages/author/AuthorHandler.inc.php to the 2.3.6 version, and the redirection worked as before, but the article page didn't show up at all, and failed with two different PHP errors.

So now I restored the AuthorHandler.inc.php from 2.4.0 version, but I would very much like to resolve the issue with failing redirection to login when user is not logged in. This scenario is common for our journal, because the user clicks on a link in the email from the editor, but then they are confused because they end up with a blank page or an error.

With kind regards,
Ales
aleskl
 
Posts: 96
Joined: Mon Apr 11, 2011 7:08 am

Re: Link to article page fails to redirect to login in 2.4.0

Postby JasonNugent » Tue Sep 25, 2012 4:00 am

Hi Ales,

It sounds like the $user object in that test is null, which is why the call to getId()is failing. There should be a test there to ensure that the $user is not null before comparing the id values. You can try changing line 135 to:

Code: Select all
  if (!$user || ($authorSubmission->getUserId() != $user->getId())) {


Which should cause the validate() method to return false if the user does not exist. If that solves the problem for you, I'll file a bug and commit a fix.

Cheers,
Jason
JasonNugent
Site Admin
 
Posts: 849
Joined: Tue Jan 10, 2006 6:20 am

Re: Link to article page fails to redirect to login in 2.4.0

Postby JasonNugent » Wed Sep 26, 2012 2:23 pm

Hi Ales,

I think my fix solves your problem (I tested locally) so I have gone ahead and committed a fix for this. The commit is available at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=7941

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 849
Joined: Tue Jan 10, 2006 6:20 am

Re: Link to article page fails to redirect to login in 2.4.0

Postby aleskl » Thu Sep 27, 2012 4:52 am

Excellent, thank you Jason!
The fix works, a link to a user related page now redirects to login page if user is not logged in.

Thanks again,
Ales
aleskl
 
Posts: 96
Joined: Mon Apr 11, 2011 7:08 am


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], ojsearch and 1 guest