PDA

View Full Version : Social Group and Album Enhancements - Hidden Invite Only Social Groups


XiZa
07-07-2008, 10:00 PM
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:



/*
$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


//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";

$socialgroups = $this->registry->db->query_read_slave($sql);

//changed by wesley
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


WHERE groupid IN (0$socialgroupids)
to


WHERE groupid IN (0$socialgroupids) AND type != 'inviteonly'
If the group is invite only it will now just display "Viewing social group".

XiZa
07-08-2008, 06:28 PM
Let me know if it works for you or if I missed something, thanks.

XiZa
07-09-2008, 06:28 AM
Soo I'd really like some feedback, is no one interested in this hack? ..

Q-v-n-s-Q
07-09-2008, 06:44 AM
i will try this out, thanks

IcheeWaWa
07-09-2008, 01:25 PM
I'll be testing this out later today! Thanks for taking on the task.

XiZa
07-09-2008, 01:33 PM
Thanks, looking forward to that :)

Note that the files supplied are for 3.7.2, if you want to use this in an earlier version of 3.7, simply look in the files for "wesley" and copy/paste those sections over appropriately.

Ideal Web Tech
07-11-2008, 08:55 AM
It is against the vBulletin license agreement to redistribute full vBulletin files.

jilly
07-11-2008, 03:30 PM
so are we supposed to download those files and re-upload them? I don't think I want to do that, because some of my files have other modifications in them that these may overwrite - do you have a list of what to change in those files, so I can just go into them and change them manually?

XiZa
07-11-2008, 04:21 PM
Just look at the files and search for "wesley" and replace where necessary. I could make a list later.. Btw where does it say that this is not allowed ideal_web_tech?

RaTix
07-23-2008, 08:28 PM
I thought vB had added this in a newer patch and was about to update again when I saw your mod. Since I didn't feel like having to sort through what mods and customizations would be broken again because of it, I decided to give this a whirl. Unfortunately I ran into Db error when doing so.

I am Running VB 3.7.1 PL1. There seems to be no difference in the files specified except for your edits (File compare in Notepadd++), so I do not think my version of VB is the issue.

Invalid SQL:

SELECT COUNT(*) AS count
FROM vbsocialgroup AS socialgroup
LEFT JOIN vbsocialgroupmember AS socialgroupmember ON
(socialgroupmember.userid = XXXX AND socialgroupmember.groupid = socialgroup.groupid)
WHERE vbsocialgroup.type != 'inviteonly';

MySQL Error : Unknown column 'vbsocialgroup.type' in 'where

I think the problem lies within this section of your mod.

//WESLEY MOD
case 'grouplist':
{
if (!can_moderate(0, 'caneditsocialgroups')) {
$socialgroupsearch->generator->where['type'] = TABLE_PREFIX . "socialgroup.type != 'inviteonly'";
}
}
break;
//WESLEY MOD

in the group.php.

Here's the thing, it works fine for admins, but any other user will get a DB error when trying to access the Social Groups page. To make sure there was nothing else I changed or another mod perhaps conflicting. I replaced the group.php with my original 3.7.1 pl1 group.php and it works as normal.

Was this ever officially added to any newer versions or patches of VB? If not, any help to get this much desired feature working will be appreciated.

JamesAB
12-08-2008, 06:35 AM
I believe it's still not possible to hide invite only groups in vbulletin 3.8.0 RC1

Anyone else working on this?

This line should not use TABLE_PREFIX, instead try this:

$socialgroupsearch->generator->where['type'] = "socialgroup.type != 'inviteonly'";

Thanks,
James

PtitLu
01-05-2009, 12:00 PM
This line should not use TABLE_PREFIX, instead try this:Works perfectly on 3.7.4 without TABLE_PREFIX. Thanks.

PtitLu
01-06-2009, 08:30 AM
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.

donnyaz
04-06-2009, 07:32 PM
Shoot you have a great idea but I am scared so scared.

grey_goose
05-17-2011, 08:29 PM
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)

grey_goose
05-17-2011, 08:54 PM
Found another one:

//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?