MyBB Community Forums

Full Version: [F] canviewthreads error problem [C-StefanT]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
If you have it set for no viewing of threads in forumdisplay.php for a group the error message is:

"Sorry but there are currently no threads in this forum with the specified date and time limiting options."

That's because of this in forumdisplay.php not having an else statement to do error_no_permission().

if($fpermissions['canviewthreads'] != 0)
{
	// How many posts are there?
	if($datecut > 0)
	{
		$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly $datecutsql");
		$threadcount = $db->fetch_field($query, "threads");
	}
	else
	{
		$query = $db->simple_select("forums", "threads, unapprovedthreads", "fid = '{$fid}'", array('limit' => 1));
		$forum_threads = $db->fetch_array($query);
		$threadcount = $forum_threads['threads'];
		if($ismod == true)
		{
			$threadcount += $forum_threads['unapprovedthreads'];
		}
		
		// If we have 0 threads double check there aren't any "moved" threads
		if($threadcount == 0)
		{
			$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly", array('limit' => 1));
			$threadcount = $db->fetch_field($query, "threads");
		}
	}
}

To fix I believe simply adding the else statement to the end like so:

if($fpermissions['canviewthreads'] != 0)
{
	// How many posts are there?
	if($datecut > 0)
	{
		$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly $datecutsql");
		$threadcount = $db->fetch_field($query, "threads");
	}
	else
	{
		$query = $db->simple_select("forums", "threads, unapprovedthreads", "fid = '{$fid}'", array('limit' => 1));
		$forum_threads = $db->fetch_array($query);
		$threadcount = $forum_threads['threads'];
		if($ismod == true)
		{
			$threadcount += $forum_threads['unapprovedthreads'];
		}
		
		// If we have 0 threads double check there aren't any "moved" threads
		if($threadcount == 0)
		{
			$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly", array('limit' => 1));
			$threadcount = $db->fetch_field($query, "threads");
		}
	}
}else{

	error_no_permission();

}

You don't want to give a zero posts message when in fact it's a permission issue.
The point of the permission is to be able to go into the forum and see it, but not see any of the threads in it. If you don't want to be able to go into the forum itself and access anything within it then there is a separate permission for that.
Right but the error is "Sorry but there are currently no threads in this forum with the specified date and time limiting options."

It's suppose to be permission error. The reason why that's important is because permission error notifies a guests they might have to login or signup to see the threads. As it is now..the person is told there are no threads. That's not the case.

Quote:If you don't want to be able to go into the forum itself and access anything within it then there is a separate permission for that.

Ugh..I want them to be able to go into the forum...just not read the threads. That works but the error given is WRONG. There is no "seperate permission" that I am aware of. This is it.

Please don't mark this as bogus. If you can't see my reasoning in this I will do better to explain it but really...this is a problem. You can't tell someone no threads exist. I have a huge section that requires membership to view threads. If you take away this error_no_permission you are telling potential members that no posts exist. That's both unattractive and inaccurate.

Please please please...read my post carefully. If I am not explaining this well enough let me know.

EDIT: I just checked out 1.4.4 and apparently the if statement was just added:

if($fpermissions['canviewthreads'] != 0)

So the only issue is that an else statement wasn't added...because otherwise the script continues and the next part just believes there were no results and that this wasn't a permission issue.

I hope I have made this clear now.

EDIT 2: Looking at the code alternatively you can remove the if($fpermissions['canviewthreads'] != 0) and add the permission check with the if($fpermissions['canview'] != 1) statement on the top to make:

if($fpermissions['canview'] != 1 || $fpermissions['canviewthreads'] != 1 )

That would do as well.
Feel free to make a suggestion, but this change was implemented after deliberation from several members after a bug report was filed for 1.4.5 on it. I will not be as easy to persuade to reverse a confirmed fix by several members and MyBB Staff.
I don't understand.

This is so simple.

A permission exists for "Can View Threads Within a Forum"...it's a PERMISSION...and how the permission works is 100% fine. The problem is that it doesn't give out the permission error.

It was correct to add this...however it's done without the error_no_permission(). It's done with a wrong message of no threads.

Where is the thread that discussed this before and forced this change? I am sure no one intended for it to be changed to this instead. It's a break of Mybb's permission system which is to show the error_no_permission page when a permission isn't allowed.

Why would you implement this where instead it shows zero threads?

I looked at the 1.4.4 code and you did the right thing adding the canviewthreads permission check to that file. It should 100% be there. That's not the issue. I am not asking you to revert the change or the decision. It's the method you used to implement it.

Please consider this carefully what I am saying. Don't just dismiss this. Take a second and think about it.


EDIT: Found the thread: http://community.mybboard.net/thread-43658.html

It's nice having old bug fix threads available. Smile

Now take a look..even Yumi made my same suggestion:
http://community.mybboard.net/thread-436...#pid311666

Quote:Replace
PHP Code:
if($fpermissions['canview'] != 1)
with
PHP Code:
if($fpermissions['canview'] != 1 || $fpermissions['canviewthreads'] != 1)

So not sure why you think my report conflicts with past sentiment about how this should be fixed.

Again..please consider this very carefully. I would hate to see this marked as bogus and not fixed.
I am going to state this as clearly as I can this time.

You implemented a permission error properly but you did not use the error_no_permission.
I think i have the same problem on my forum?
Here is a thread. http://ftw.net.au/forum-17.html which does contain posts ofcourse. Now when logged out you get "Sorry but there are currently no threads in this forum with the specified date and time limiting options."
Now this is not the case. It used to show "Sorry but you do not have permission to view here."
I may be wrong but this does appear to be a bug?
Last thing i want is search engines and the like listing as the new message of no threads..
OK, this is my take on it. I'm thinking out loud so it's not in any particular order.

In <= 1.4.4, if 'Can view threads within forum?' was unticked, all the threads would still show up as normal, both on the index and forumdisplay, but when trying to view them, it would give you a no perms page. The only bug report I can remember on this was that if you unticked 'Can post threads?' on the 'main' permissions, it unticked 'Can view threads within forum?' in the 'advanced' permissions, which wasn't expected. Unless I'm forgetting another one, that's the only one I can think of. I also think some people were confused as to whether 'Can view threads within forum?' meant they can't see the threads at all, or they can't see the contents, although I may be getting that confused with something else.

In >= 1.4.5, if 'Can view threads within forum?' was unticked, you see a - on the index/forumdisplay, and, yes, when going inside the forum, it says there's nothing within your time/date options etc. To be totally honest I think both of these could be improved on. I think the fact that it says - on the index can be misleading, it makes it looks like it isn't active or something, that it's closed or an archive, at least that's how I see it; having the usual count of threads and posts, and having a - in the last post section would make more sense. That way, you can see it's active, and that there are posts in there, but you can't see them, hence the last post being a -, as it's hiding the last thread name. Then, when you click it, I agree it should show a no perms page because otherwise it does indeed look like it's empty, and AFAIK that isn't the point, to make it look empty, it's to not make it possible to see the contents. Is there really much point in being able to go inside the forum to see the message that you see?? I think it will indeed put members off, or confuse them. If they see a no permissions page, they'll know that they can't view the contents.

Actually... hmm, I just had a thought about why it might be like it is... if it's a no perms page it makes it look like they can't view the forum itself, not that they can't view the contents of the threads, which is slightly different... OK, how about instead of saying that there are no threads that match your criteria, it says something that's more relevant?? Right now it's saying it's to do with date and time, which it isn't. If you don't want a no perms page, a message to replace the current one may be better.
Quote:If you don't want a no perms page, a message to replace the current one may be better.

I DO WANT A NO PERM PAGE!

The way it is now...no list of threads is displayed but the error is "Sorry but there are currently no threads in this forum with the specified date and time limiting options."

When it suppose to be an error_no_permission page. That's just how mybb works.

1. You have an admincp permission setting.
2. That setting allows/disallows content.
3. The setting if disallowed displays error_no_permission for a content request.

The above is how mybb handles errors.

This is how it is now:

1. You have an admincp permission setting.
2. That setting allows/disallows content.
3. The setting if disallowed displays a false error for the content saying no posts exists.


Quote:I think the fact that it says - on the index can be misleading, it makes it looks like it isn't active or something, that it's closed or an archive, at least that's how I see it; having the usual count of threads and posts, and having a - in the last post section would make more sense. That way, you can see it's active, and that there are posts in there, but you can't see them, hence the last post being a -, as it's hiding the last thread name.

My report is 100% unrelated to what you're saying. How it works now is 100% fine imho. Maybe at best change the - into "hidden" but overall that's not a big deal. Heck I should look and see if it's changable in the lang files. My report is based on error handling.

Imagine you go to signup and register and when you go to type the captcha and get an error it says "Sorry this forum is not accepting new members". It's the wrong error. It's misleading. It's inaccurate. A hidden forum on any mybb site will now tell every guests that no posts exists.

Example sites:
http://www.pwnem.com/ (click the Introductions forum)
http://www.mig33indo.com/forum/index.php (Mig33 Applications forum)
http://www.ftw.net.au/ (half his forums are members only..now guests think the site is dead with zero posts)
(2009-05-04, 01:37 PM)labrocca Wrote: [ -> ]
Quote:If you don't want a no perms page, a message to replace the current one may be better.

I DO WANT A NO PERM PAGE!

I know, that was more for Ryan - if he doesn't want to put in a no perms page, and there is just going to be a message like there is now, then in my opinion the message that is there should at least be relevant, which right now it isn't.

labrocca Wrote:It's suppose to be permission error. The reason why that's important is because permission error notifies a guests they might have to login or signup to see the threads. As it is now..the person is told there are no threads.

So, if there's not a normal, generic no perms page for whatever reasons, the message that is there shouldn't say what it does now because, like you said, it says there's no threads which doesn't explain that they have to login/register, meaning the error would make more sense if it said something along those lines. That's what I was getting at; just my opinion on how I'd do it.

(2009-05-04, 01:37 PM)labrocca Wrote: [ -> ]
Quote:I think the fact that it says - on the index can be misleading, it makes it looks like it isn't active or something, that it's closed or an archive, at least that's how I see it; having the usual count of threads and posts, and having a - in the last post section would make more sense. That way, you can see it's active, and that there are posts in there, but you can't see them, hence the last post being a -, as it's hiding the last thread name.

My report is 100% unrelated to what you're saying. How it works now is 100% fine imho. Maybe at best change the - into "hidden" but overall that's not a big deal. Heck I should look and see if it's changable in the lang files. My report is based on error handling.

Yeah I went off on a tangent there, that was just my opinion again about how the permission works now, not what shows inside the forum, i.e. whether there's a no perms page or not inside the forum.

Looking at it again, most of what I said wasn't totally related, not really with it today for some reason, I think I have something else in my mind, but I just don't think the permission is setup properly really, so I guess it should be in a suggestion thread, not here.
The permission is setup fine...it's the error that was missed.

He added a permission check but no error. The error that does get put out happens later in the script because the function to pull sql results was bypassed (no permissions) but didn't get stopped by an error_no_permission();

It breaks mybb standards.
Pages: 1 2 3 4