!!WARNING!!
Long post, don't skim, take time to read or don't read at all.
Here is what I am going to go over in this post, (in order),
- Explanation of whats happening and why.
- Send you to a video tutorial I did about forum permissions which I do talk about groups in it. (just note, in the video I don't think i mentioned this, but if you set up groups like I said in there, this wouldn't be really an issue.).
- Little rant on how annoyed I am over this, mostly with those that lead me to believe they understood what i was talking about when they actually had no clue what I was talking about.
- Message to all that ask for my help.
- The code and what to edit
- How my code works, and explanation. Video just added.
Have you ran into a situation where you went to add a block onto your site, but you only wanted specific groups to see it, to you went in and set the block to groups only, and you selected a few groups, and after doing that, you find that there is multiple blocks now showing on your home page?
Well, if this has happened to you, and you came to me before and asked about it, then I probably told you to edit your groups to make it easier. I still stand by that. I don't get why a clan would set up something like, Leader, lieutenant, and members, and not put the leaders and lieutenant into the member group. Just say everyone in the clan was in the member group, then just say they got promoted to lieutenant, leave them in the member group, just add them to the lieutenant group. That way is you want something to be shown only to members, all you have to do is set the item to the members and that's it.
I do go over this in my forum permissions video tutorial.
Well, I coded a workaround because some people that ask for my help choose to ignore it, or just didn't understand me, and when it effects them, they don't understand why even though they were told about it. I am not mentioning names, but, in the last week, this has popped up 4 times. Yes, that is right, four times. What I find strange is I haven't had anyone ask me about this issue for maybe a year, then I get it four times in 1 week.
Here is essentially what your would see if you run into this problem:
But from your admin panel it just was there once.
Well, it comes to light only when trying to set a block only for specific groups to see. Otherwise this goes unseen. If you set up the groups with careful planning knowing that this could happen, its easy to avoid, but, if you had no knowledge of this happening, it is easy to cause this issue with setting of the groups.
Well, finally I got around to coding a quick fix for this and I will explain my fix and how it works below. You can see the actual diffchecker here:
Check it out here:
Here is the code to fix this issue:
Open up your public_html/mainfile.php
Find:
PHP: [ Select all ]
if (empty($blockrow[$i]['bkey'])) {
if ( ($view == '0' || $view == '1') ||
( ($view == '3' AND is_user()) ) ||
( $view == '4' AND is_admin()) ||
( ($view == '2' AND !is_user())) ) {
render_blocks($side, $blockrow[$i]);
} else {
if (substr($view, strlen($view)-1) == '-') {
$ingroups = explode('-', $view);
if (is_array($ingroups)) {
foreach ($ingroups as $group) {
if (isset($userinfo['groups'][($group)])) {
render_blocks($side, $blockrow[$i]);
}
}
}
}
}
}
}
return;
}
PHP: [ Select all ]
if (empty($blockrow[$i]['bkey'])) {
if ( ($view == '0' || $view == '1') ||
( ($view == '3' AND is_user()) ) ||
( $view == '4' AND is_admin()) ||
( ($view == '2' AND !is_user())) ) {
render_blocks($side, $blockrow[$i]);
} else {
if (substr($view, strlen($view)-1) == '-') {
$ingroups = explode('-', $view);
if (is_array($ingroups)) {
$cnt = 0;
foreach ($ingroups as $group) {
if (isset($userinfo['groups'][($group)])) {
$cnt++;
}
}
if ($cnt != 0){
render_blocks($side, $blockrow[$i]);
}
}
}
}
}
}
return;
}