By Jordan Weinstein on Monday, 12 May 2014
Posted in Technical Issues
Replies 12
Likes 0
Views 639
Votes 0
Hello,

I have custom user groups set up a Joomla 3 / EasyDiscuss site. Permissions are correctly set up for users assigned to a group to see a discussion item. After a recent ED update, when public users access a restricted URL, they get a 404 error, whereas before the update, they would receive a notice that they have to log in to access that item (like on the Stackideas site).

I have included site in for below with sample links. If there are any fixes, please provide file patches so I can have for other sites.

Jordan
Hello Jordan,

This is actually a feature requested by users here. They were requesting that we use Joomla's API to log 404 errors and this is the standard way of reporting these 404's. In other words, your user shouldn't see this link actually
·
Tuesday, 13 May 2014 02:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

They will see the link when they get an email notification about a new post to the question. And now when they click it, they get a 404, not a login prompt. So I would think this is quite poor for usability and confusing for the users receiving the notifications.

Jordan
·
Tuesday, 13 May 2014 02:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

As I think more about this, the change in handling for non-public items to show a 404 really breaks the usability of EasyDiscuss. It's not how the Stackideas forum even functions.

Now, if a user tries to load a page after their login expires, a 404 will appear - this is very confusing to the user. All email notification links to non-public will produce a 404 if the user is not logged in. Again, this is very bad for usability and not how Joomla functions. As you know, if you access a non public article in Joomla, the user does not see a 404 but a login prompt.

I really hope this decision is reconsidered. Otherwise, could there be a admin-configurable option to handle non-public links? Perhaps, admins could select whether to show a 404 (as currently happens) or whether to show a login prompt with a user friendly 'forbidden' message.

Regards,

Jordan
·
Tuesday, 13 May 2014 05:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jordan,

I am really sorry for the delay of this reply as it is actually a public day off for us here. Hm, if the user cannot access that particular category, they shouldn't actually be receiving any emails at all. Did you configure the notifications to send to everyone on the site?
·
Tuesday, 13 May 2014 17:06
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

No, what I'm talking about is much more basic than that. If a user receives a notification about a post which he is subscribed to (and which he has permission for), them he will correctly receive a notification by email about new answers. But now, when he clicks the link to read the discussion, he gets a 404 message if not logged in to the site. The same goes for if he reloads a page after his login expires, he gets a 404. In both cases, he should get a login prompt, asking him to login in order to access the requested item. A 404 implies the item does not exist,

Take this forum on Stackideas for example, if I click a link or load a page for a thread but I have not logged in to the site, I get a message that the forum is for members only and to log in - this to me is correct. But on the current version of EasyDiscuss, one would get a 404.

Jordan
·
Tuesday, 13 May 2014 18:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jordan,

Thanks for your clarification.

Regarding if user do not have permission to view, currently it show a 404 page. Maybe we should give an option to admin to decide if user should see 404 page or redirect to index page and prompt to login to view

As for now, what you can do is edit the file 'JOOMLA/components/com_easydiscuss/views/post/view.html.php' and look for below block of code at line 79:


if ($post->category_id && !$category->canAccess()) {
return JError::raiseError(404, JText::_('COM_EASYDISCUSS_SYSTEM_POST_NOT_FOUND'));
}


and replace the above with folowing:


if ($post->category_id && !$category->canAccess()) {
DiscussHelper::setMessageQueue( JText::_('COM_EASYDISCUSS_NO_PERMISSION_TO_VIEW_POST') , 'error' );
$app->redirect( DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false)) ;
}


Let me know if the above code work for you or not
Hope this help and have a nice day
Sam
·
Wednesday, 14 May 2014 16:00
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Sam,

That's definitely an improvement. A 404 just isn't helpful or accurate.

The only thing I see is that the return URL which gets encoded, returns the user to:

index.php?option=com_easydiscuss&view=categories

It would be helpful if the return URL brought the user to the original requested post.

Jordan
·
Wednesday, 14 May 2014 19:38
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jordan,

Can you try this code instead?


if ($post->category_id && !$category->canAccess()) {
DiscussHelper::setMessageQueue( JText::_('COM_EASYDISCUSS_NO_PERMISSION_TO_VIEW_POST') , 'error' );
$app->redirect( DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false)) ;
}
·
Wednesday, 14 May 2014 23:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark,

Your version caused a redirect loop and the site won't load. Clearing cookies did not help:

This webpage has a redirect loop


The webpage at http://www.DOMAIN.com/support-forum/wcn-2015-website-2 has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
·
Thursday, 15 May 2014 00:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jordan,

Ops, sorry I misread your post above. If you apply the hacks that Sam provided above, when the user accesses the restricted discussion, they get redirected to your discussion front page. But at this point of time, we cannot redirect back the user to the original page
·
Thursday, 15 May 2014 01:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark,

Will this change be part of the core or a hack? Or perhaps user configurable?

J
·
Thursday, 15 May 2014 02:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jordan,

Will this change be part of the core or a hack? Or perhaps user configurable?


The code provided is just a temporary fix. You might want to keep the code until we have a proper solution to address this matter
Hope this help and have a nice day!
Sam
·
Thursday, 15 May 2014 10:37
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post