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
A reasonable solution imho and thanks for having this worked out.

The mod for this to work the 1.4.6 method is a very easy hook and permission check for that.
I'm not sure how much research the MyBB team does on say vBulletin or IPB,
but it is a forum standard for permissions to be set so that a guest user can:
1) See a forum
2) See the threads listed in the forum, and the thread count
3) Click the thread, and be faced with a Login/Register page.

And labrocca your fix just gives them a login page when they click the forum. It should give a login page when they click the thread instead. And you should be able to see Thread Count on the index page.

Get it? Simple right? It is a standard after all.
(2009-05-14, 05:58 PM)eXecute Wrote: [ -> ]I'm not sure how much research the MyBB team does on say vBulletin or IPB,

Yes, we spend all of our time studying vB and IPB. Rolleyes
(2009-05-14, 06:03 PM)Ryan Gordon Wrote: [ -> ]
(2009-05-14, 05:58 PM)eXecute Wrote: [ -> ]I'm not sure how much research the MyBB team does on say vBulletin or IPB,

Yes, we spend all of our time studying vB and IPB. Rolleyes

That's great!!! Very very good, studying the competition is the #1 way to defeat them. It's good news, I really appreciate developers who study the competition and try their best to defeat them.

If you wanna see a working example of how a standardized forum should work in permissions go to the forum in my signature, click on any of the forums in "General Programming" category, and then try clicking on a thread. That's I think what Labrocca REALLY wants.

HERE's the proper code fixes:

In order to fix your MyBB code to match the behavior of my permissions in the forum in my signature...

Edit Forumdisplay.php: (i commented out the original code, so just try and find the similar coding in your file)
/*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();
} 
*/

Then don't forget to put ratings back to way they were.

$multipage = multipage($threadcount, $perpage, $page, $page_url);

if($foruminfo['allowtratings'] != 0)/* && $fpermissions['canviewthreads'] != 0)*/
{
	$lang->load("ratethread");

Then also don't forget to fix this area:
$icon_cache = $cache->read("posticons");

/*if($fpermissions['canviewthreads'] != 0)
{*/
	// Start Getting Threads
	$query = $db->query("
		SELECT t.*, {$ratingadd}{$select_rating_user}t.username AS threadusername, u.username
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid){$select_voting}
		WHERE t.fid='$fid' $tvisibleonly $datecutsql2
		ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2
		LIMIT $start, $perpage
	");
	while($thread = $db->fetch_array($query))
	{
		if($db->type == "pgsql")
		{
			$thread['averagerating'] = $averagerating[$thread['tid']];
		}

		$threadcache[$thread['tid']] = $thread;

		// If this is a moved thread - set the tid for participation marking and thread read marking to that of the moved thread
		if(substr($thread['closed'], 0, 5) == "moved")
		{
			$tid = substr($thread['closed'], 6);
			if(!$tids[$tid])
			{
				$moved_threads[$tid] = $thread['tid'];
				$tids[$thread['tid']] = $tid;
			}
		}
		// Otherwise - set it to the plain thread ID
		else
		{
			$tids[$thread['tid']] = $thread['tid'];
			if($moved_threads[$tid])
			{
				unset($moved_threads[$tid]);
			}
		}
	}
/*}
else
{
	$tids = $threadcache = null;
}*/

THEN, don't forget to edit /inc/functions_forumlist.php
Find this area and match the code:
$hideinfo = false;
			$showlockicon = 0;
			/*if($permissions['canviewthreads'] != 1)
			{
			    $hideinfo = true;
			}*/


So then you guys are also planning to change this then:
"Create a
Select the type of forum you are creating - a forum you can post in, or a category, which contains other forums.
[]Forum
[]Category"
to
"Create a
Select the type of forum you are creating - a forum you can post in, or a category, which contains other forums.
[]Forum
[]Category
[]Redirect"

Right? (Sorry I didn't want to make a whole thread just for that little feature.)
Please don't use that fix. The MyBB Team will provide their own fix in the next release which is tested by the SQA Team.
(2009-05-14, 06:16 PM)Ryan Gordon Wrote: [ -> ]Please don't use that fix. The MyBB Team will provide their own fix in the next release which is tested by the SQA Team.

Right it's just a temporary fix until you guys properly fix it. There is no security risk and the code modifications, don't conflict with say "hidden forums" or anything.
I already have adjusted my forums even before I made this thread.

Quote:That's great!!! Very very good, studying the competition is the #1 way to defeat them. It's good news, I really appreciate developers who study the competition and try their best to defeat them.

I think you missed the sarcasm in that statement.

Either way this is going to be fixed for 1.4.7 back to how it was and should be.
(2009-05-14, 06:54 PM)labrocca Wrote: [ -> ]I already have adjusted my forums even before I made this thread.

Quote:That's great!!! Very very good, studying the competition is the #1 way to defeat them. It's good news, I really appreciate developers who study the competition and try their best to defeat them.

I think you missed the sarcasm in that statement.

Either way this is going to be fixed for 1.4.7 back to how it was and should be.

You're saying they don't study the competition?
Well that would mean they are extremely obtuse, and I don't think they are.

And did you understand my fix? It was different from what you posted on page 1.
(2009-05-15, 03:25 AM)eXecute Wrote: [ -> ]You're saying they don't study the competition?
Well that would mean they are extremely obtuse, and I don't think they are.

We do not copy our competitors. That is illegal, immoral, and it slights our creative sword.

(2009-05-15, 03:25 AM)eXecute Wrote: [ -> ]And did you understand my fix? It was different from what you posted on page 1.

The MyBB Team will provide official fixes for the MyBB Software. If you are not a MyBB Developer then please do not provide fixes if requested not to.
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Pages: 1 2 3 4