Advertisement:

Author Topic: View/Enter Board Permissions  (Read 51038 times)

Offline camoura

  • Semi-Newbie
  • *
  • Posts: 48
Re: View/Enter Board Permissions
« Reply #120 on: September 05, 2010, 02:00:06 AM »

Offline Stigmartyr

  • Jr. Member
  • **
  • Posts: 300
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #121 on: October 09, 2010, 06:05:16 PM »
excellent mod man took me a minute to figure out how to set it up but it is awesome :) :)

Im finding it a little confusing to make this mod useful as well.

Originally I'd wanted to restrict posting to some boards until a post count was reached and I can't really figure out the best way to do that as the board only allows you to assign one kind of permission profile.

Anyone able to share some insight?

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #122 on: January 06, 2011, 09:40:06 PM »
i had a mod that worked on RC2 called view/enter board permission. I lost it when i updated to RC4 I have tried getting it to work and cannot i get tons of errors using RC2 emulation so my ??? is there a more current updated mod out there that will do what that mod does

I want members to be able to see boards but not enter them

any help will be greatly appreciated
Running Rc4

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,749
Re: View/Enter Board Permissions
« Reply #123 on: January 07, 2011, 05:50:06 AM »
please use the support thread for that mod, and request the author to update it. you could also try http://custom.simplemachines.org/mods/index.php?mod=1332 which i have heard still works with current versions.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,993
    • StoryBB/StoryBB on GitHub
Re: View/Enter Board Permissions
« Reply #124 on: January 07, 2011, 06:46:33 AM »
Quote
please use the support thread for that mod, and request the author to update it.

The original author will not update it, and the current maintainer doesn't seem to have time. I'm just glad I gave it away to be honest, caused much more trouble than it saved writing that mod, most people just didn't understand what it did, and why it looked like it broke their forum (when they just didn't read the instructions)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Spoogs

  • SMF Hero
  • ******
  • Posts: 1,676
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #125 on: January 07, 2011, 08:36:37 AM »
I actually love this mod and have it updated for my use... ssems fairly easy to maintain... I've even wondered if I should ask to take it over.... hmmmmmmm, pondering.


most people just didn't understand what it did, and why it looked like it broke their forum (when they just didn't read the instructions)
Agreed I would get PM's even after explicitly stating that all board permissions will need to be redone... oh well.


@OP

Code: ( sources/load.php FIND) [Select]
if ($user_info['is_admin'])
$user_info['query_see_board'] = '1=1';
// Otherwise just the groups in $user_info['groups'].
else
$user_info['query_see_board'] = '(FIND_IN_SET(' . implode(', b.member_groups) != 0 OR FIND_IN_SET(', $user_info['groups']) . ', b.member_groups) != 0' . (isset($user_info['mod_cache']) ? ' OR ' . $user_info['mod_cache']['mq'] : '') . ')';

Code: ( replace with) [Select]
loadBoardsVisibility();



Code: ( themes/default/Maganeboards.template.php FIND) [Select]
</dd>
<dt>
<strong>', $txt['mboards_groups'], ':</strong><br />
<span class="smalltext">', $txt['mboards_groups_desc'], '</span>
</dt>
<dd>';

// List all the membergroups so the user can choose who may access this board.
foreach ($context['groups'] as $group)
echo '
<label for="groups_', $group['id'], '">
<input type="checkbox" name="groups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' class="input_check" />
<span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : '', $group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : '', '>
', $group['name'], '
</span>
</label><br />';
echo '
<em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[]\');" /><br />
<br />
</dd>';

Code: ( replace with) [Select]
</dd>';
// We don't need membergroups, we don't need no DB control :P
« Last Edit: January 07, 2011, 09:08:06 AM by Spoogs »

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #126 on: January 07, 2011, 10:31:51 AM »
wow that is the exact edits i had to make but your a just a tad different I will try that when i get home

thanks alot

Running Rc4

Offline Spoogs

  • SMF Hero
  • ******
  • Posts: 1,676
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #127 on: January 07, 2011, 10:39:41 AM »
the code is different between RC2 and RC4, the mod is telling you to look for the RC2 code ;)

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #128 on: January 07, 2011, 10:58:51 AM »
exactly i see that i am hopeful this will work

looks good


I won't know till later

I will update accordingly

thanks
Running Rc4

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #129 on: January 07, 2011, 06:36:48 PM »
ok i installed and made the edits and i get this error

Fatal error: Call to undefined function loadboardsvisibility() in /home/lostzer1/public_html/appfuzion.com/Sources/Load.php on line 566

I have attached the 2 files can you please take a look and see what is wrong



Running Rc4

Offline Spoogs

  • SMF Hero
  • ******
  • Posts: 1,676
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #130 on: January 07, 2011, 07:08:07 PM »
try these

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #131 on: January 07, 2011, 07:15:36 PM »
same error

Call to undefined function loadboardsvisibility() in /home/lostzer1/public_html/appfuzion.com/Sources/Load.php on line 566
Running Rc4

Offline Spoogs

  • SMF Hero
  • ******
  • Posts: 1,676
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #132 on: January 07, 2011, 07:18:58 PM »
hmmm thats weird... are you sure you installed the mod?

try this

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,993
    • StoryBB/StoryBB on GitHub
Re: View/Enter Board Permissions
« Reply #133 on: January 07, 2011, 07:19:26 PM »
One of the instructions was missed, that this has to go at the end of Load.php.

Code: [Select]

// Figure out what we can see. Note, because this sets up query_see_board, we cannot call boardsAllowedTo() :(
function loadBoardsVisibility() {
global $user_info, $smcFunc;

if($user_info['is_admin']) {
$user_info['query_see_board'] = '1=1';
$user_info['query_see_only_board'] = '1=1';
return;
}

// SLOW QUERY?
$query = $smcFunc['db_query']('', '
SELECT b.id_board, bp.permission, bp.add_deny
FROM {db_prefix}boards AS b INNER JOIN {db_prefix}board_permissions AS bp ON (b.id_profile = bp.id_profile)
WHERE id_group IN ({array_int:groups}) AND bp.permission IN ({array_string:permission})',
array(
'groups' => $user_info['groups'],
'permission' => array('view_board', 'enter_board'),
)
);

$boards = array(
'allow' => array(
'view_board' => array(),
'enter_board' => array(),
),
'deny' => array(
'view_board' => array(),
'enter_board' => array(),
)
);

while($row = $smcFunc['db_fetch_assoc']($query)) {
$area = $row['add_deny'] ? 'allow' : 'deny';
$boards[$area][$row['permission']][] = $row['id_board'];
}
$smcFunc['db_free_result']($query);

$allow = array_diff($boards['allow']['view_board'], $boards['deny']['view_board']);
$user_info['query_see_only_board'] = count($allow) > 0 ? 'b.id_board IN (' . implode(',', $allow) . ')' : '1=0';

$allow = array_diff($boards['allow']['enter_board'], $boards['deny']['enter_board']);
$user_info['query_see_board'] = count($allow) > 0 ? 'b.id_board IN (' . implode(',', $allow) . ')' : '1=0';
}
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Spoogs

  • SMF Hero
  • ******
  • Posts: 1,676
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #134 on: January 07, 2011, 07:24:11 PM »
Ahh thats it... I hadnt looked that far down since that part doesnt fail on install

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #135 on: January 07, 2011, 07:26:53 PM »
that did it man thanks guys really appreciate it

it is working fine

you rock
Running Rc4

Offline Spoogs

  • SMF Hero
  • ******
  • Posts: 1,676
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #136 on: January 07, 2011, 07:33:10 PM »
glad its working for ya now... I really should have checked all the edits tho (now I know better :) )

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #137 on: January 07, 2011, 07:53:47 PM »
no worries man there is no better community than the smf community

appreciate the help

Running Rc4

Offline sattninja

  • Sr. Member
  • ****
  • Posts: 701
    • Appfuzion.com
Re: View/Enter Board Permissions
« Reply #138 on: January 07, 2011, 08:02:37 PM »
i have one more question i have made a profile for guests to be able to view a board and enter it to see threads and it is half working it lets the guest see the board but when i try to go into it as a guest it kicks me to the register/login board
Running Rc4

Offline Spoogs

  • SMF Hero
  • ******
  • Posts: 1,676
  • Gender: Male
Re: View/Enter Board Permissions
« Reply #139 on: January 07, 2011, 08:07:01 PM »
double check the permissions... i just tried it and its working as intended.