Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] Limit showthread in one forum to one group.
#1
Not Solved
I'm trying to do a little edit to showthread.php to disallow thread viewing to ONE usergroup, but allow viewing on the forumdisplay by all. Any idea how to do this without a plugin?
#2
Not Solved
You're better off doing it with a plugin. Core edits are messy and will make upgrading harder.

Regardless, this should work:

if(in_array($mybb->user['usergroup'], array(1,2)) && $mybb->input['fid'] == 73) {
    error_no_permission();
}

Just edit the array of usergroups to your liking.
No longer involved in the MyBB project.
#3
Not Solved
(2012-11-21, 04:07 AM)Nathan Malcolm Wrote: You're better off doing it with a plugin. Core edits are messy and will make upgrading harder.

Regardless, this should work:

if(in_array($mybb->user['usergroup'], array(1,2)) && $mybb->input['fid'] == 73) {
    error_no_permission();
}

Just edit the array of usergroups to your liking.

Alright, can you point me to a working plugin for 1.6.8?
Thank you for your help. Smile
#4
Not Solved
interested to know which plugin too. Big Grin
#5
Not Solved
I don't believe there is one available. It's only a few lines of code. You just need to hook on to showthread_start and execute the above code in a function.
No longer involved in the MyBB project.
#6
Not Solved
where in the code must i insert the lines and which usergroup is the guest?
#7
Not Solved
(2012-11-21, 04:36 AM)enhu Wrote: where in the code must i insert the lines and which usergroup is the guest?

Added right behind this part:

$plugins->run_hooks("showthread_start");

Guests group id is 1.
#8
Not Solved
I put this together, but it's not working. Any idea?

<?php

function nonsponsor_block_info()
{
	return array(
		"name"			=> "Non Sponsor Block",
		"description"	=> "Blocks premium tips and tricks to non sponsors.",
		"website"		=> "",
		"author"		=> "",
		"authorsite"	=> "",
		"version"		=> "1.0",
		"guid" 			=> "",
		"compatibility" => "1*"
	);
}

$plugins->add_hook('showthread_start', 'nonsponsor_block');
$plugins->add_hook('archive_thread_start', 'nonsponsor_block');

function nonsponsor_block() 
{
if(in_array($mybb->user['usergroup'], array(1,2,5,10,12,13,14,19,21,22,24)) && $mybb->input['fid'] == 73) {
    error_no_permission();
} 
}
?>
#9
Not Solved
function nonsponsor_block() 
{
global $mybb;
if(in_array($mybb->user['usergroup'], array(1,2,5,10,12,13,14,19,21,22,24)) && $mybb->input['fid'] == 73) {
    error_no_permission();
} 
}
No longer involved in the MyBB project.
#10
Not Solved
It still doesn't seem to be working, I don't know if I'm doing something wrong or what. I can provide a test account if you wish. Thanks for your efforts Nathan.


Forum Jump:


Users browsing this thread: 1 Guest(s)