Version: 1.02, by XiZa
Developer Last Online: Nov 2008
Category: Social Group and Album Enhancements -
Version: 3.7.2
Rating:
Released: 07-07-2008
Last Update: 07-07-2008
Installs: 15
Code Changes
No support by the author.
Hello,
I've made a code modification to hide invite only social groups from the group.php page (including search). If you are an admin, you will still see those groups listed even if you are not a member of them.
Anyway so this hack does the following:
- Removes all invite only social groups from the group list page.
- Shows an error when you try to access the group by URL if you're not a member or not invited.
Same for picture page, etc.
I just made this today and it seems like it works, but please for now test it locally first!
I didn't make a plugin since there don't seem to be hooks in the locations that I need.
Instructions:
Download the new group.php and replace your old one. Alternatively, find all the sections labeled //WESLEY mod and do the replacements manually.
UPDATE:
I also added two other replacement files, you can either just download them or follow along here to do the updates yourself..
To also remove the invitation only social groups from the list on the profile page, open includes/class_profileblock.php and go to line 1130 or so.
Remove this:
PHP Code:
/* $socialgroups = $this->registry->db->query_read_slave(" SELECT socialgroup.* FROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember INNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgroupmember.groupid) WHERE socialgroupmember.userid = " . $this->profile->userinfo['userid'] . " AND socialgroupmember.type = 'member' ORDER BY socialgroup.name ");
*/ //REMOVED BY WESLEY
Replace by this
PHP Code:
//changed by wesley $sql = "SELECT socialgroup.* FROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember INNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgroupmember.groupid) WHERE socialgroupmember.userid = " . $this->profile->userinfo['userid'] . " AND socialgroupmember.type = 'member' " . (!can_moderate(0, 'caneditsocialgroups') ? " AND socialgroup.type != 'inviteonly'" : "") . " ORDER BY socialgroup.name";
Lastly, if you do not want to show a link to the social group from the last activity bit ("Viewing social group: link") open includes/functions_online.php
Go to line 2182
Change
PHP Code:
WHERE groupid IN (0$socialgroupids)
to
PHP Code:
WHERE groupid IN (0$socialgroupids) AND type != 'inviteonly'
If the group is invite only it will now just display "Viewing social group".
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
With your mod installed it is no longer possible to view the date/hour of the last post in the group you belong to. Would it be possible to display this (only hour or hour and name of the poster) ?
Thanks.
Seems to work fine with the groups.php and modifying functions_online.php. I get an error with the class_profileblock.php.
Using 3.8.6; would like to see this updated.
EDIT:
Ooops, doesn't work. Get an error on a new group creation:
A required field called socialgroupcategoryid is missing or has an invalid value.
(Category dropdown is non-functional)
//wesley MOD // If a group id is specified, but the group doesn't exist, error out if ($vbulletin->GPC['groupid']) { $group = fetch_socialgroupinfo($vbulletin->GPC['groupid']);
if (empty($group)) { standard_error(fetch_error('invalidid', $vbphrase['social_group'], $vbulletin->options['contactuslink'])); } else if ($group['type'] == 'inviteonly' && $group['membertype'] != 'member' AND $group['membertype'] != 'invited' && !can_moderate(0, 'caneditsocialgroups')) { print_no_permissions(); } } //WESLEY MOD
The last line should be:
print_no_permission();
Note that the 's' is removed from permission. I guess this is a 3.8 change?