Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
Private Social Groups Details »»
Private Social Groups
Version: 1.00, by grey_goose grey_goose is offline
Developer Last Online: Mar 2020 Show Printable Version Email this Page

Category: Social Group and Album Enhancements - Version: 4.1.4 Rating:
Released: 07-14-2011 Last Update: Never Installs: 10
Code Changes Translations  
No support by the author.

Some may not have noticed, but vb4 no longer supports restricting Moderators from viewing Join-To-View/Invite Only content.

This modification does the following:
- Restricts Moderator access
- Hides the display of Social Groups set to Invite Only/Join-To-View (similar to this)

These are file edits. Back up your original files.

Included in the zip are changed files which can be used as replacements; for those that prefer to make the changes manually, here they are.

1) In /group.php
Find (~ line365):
Code:
// If a group id is specified, but the group doesn't exist, error out
if ($vbulletin->GPC['groupid'])
{
    $group = fetch_socialgroupinfo($vbulletin->GPC['groupid'], true);

    if (empty($group))
    {
        standard_error(fetch_error('invalidid', $vbphrase['social_group'], $vbulletin->options['contactuslink']));
    }
Replace with:
Code:
// If a group id is specified, but the group doesn't exist, error out
if ($vbulletin->GPC['groupid'])
{
    $group = fetch_socialgroupinfo($vbulletin->GPC['groupid'], true);

    if (empty($group))
    {
        standard_error(fetch_error('invalidid', $vbphrase['social_group'], $vbulletin->options['contactuslink']));
    }

    $group = prepare_socialgroup($group);

    // Disallow everything except joining if you can't view a
    // group's content.
    if(
        !$group['canviewcontent']
        AND $group['type'] == 'inviteonly'
        AND $_REQUEST['do'] != 'join'
        AND $_REQUEST['do'] != 'dojoin'
    )
        print_no_permission();
}
2) In /group.php
Find (~ line 653):
Code:
                $group = prepare_socialgroup($group);

                $group['canjoin'] = can_join_group($group);
                $group['canleave'] = can_leave_group($group);

                $show['pending_link'] = (fetch_socialgroup_modperm('caninvitemoderatemembers', $group) AND $group['moderatedmembers'] > 0);
                $show['lastpostinfo'] = ($group['lastposterid']);

                ($hook = vBulletinHook::fetch_hook('group_list_groupbit')) ? eval($hook) : false;

                $templater = vB_Template::create('socialgroups_grouplist_bit');
                    $templater->register('group', $group);
                    $templater->register('lastpostalt', $lastpostalt);
                $grouplist .= $templater->render();

            }
        }
Replace with:
Code:
                // Only show groups if we can view the
                // content or this is an invitation
                $group = prepare_socialgroup($group);
                if(
                    $group['canviewcontent']
                    OR $group['type'] != 'inviteonly'
                    OR $_REQUEST['do'] == 'invitations'
                )
                {
                    $group['canjoin'] = can_join_group($group);
                    $group['canleave'] = can_leave_group($group);

                    $show['pending_link'] = (fetch_socialgroup_modperm('caninvitemoderatemembers', $group) AND $group['moderatedmembers'] > 0);
                    $show['lastpostinfo'] = ($group['lastposterid']);

                    ($hook = vBulletinHook::fetch_hook('group_list_groupbit')) ? eval($hook) : false;

                    $templater = vB_Template::create('socialgroups_grouplist_bit');
                    $templater->register('group', $group);
                    $templater->register('lastpostalt', $lastpostalt);
                    $grouplist .= $templater->render();
                }
            }
        }
3) In /includes/functions_socialgroup.php
Find (~ line 699):
Code:
             ) // The above means that you dont have to join to view
            OR $group['membertype'] == 'member'
            // Or can moderate comments
            OR can_moderate(0, 'canmoderategroupmessages')
            OR can_moderate(0, 'canremovegroupmessages')
            OR can_moderate(0, 'candeletegroupmessages')
            OR fetch_socialgroup_perm('canalwayspostmessage')
            OR fetch_socialgroup_perm('canalwascreatediscussion')
        )
    );
Replace with:
Code:
            ) // The above means that you dont have to join to view
            OR $group['membertype'] == 'member'
        )
    );
4) In /includes/functions_socialgroup.php
Find (~ line 1829):
Code:
     $groups = array();
    while ($group = $vbulletin->db->fetch_array($result))
    {
        $group = prepare_socialgroup($group, true);

        $group['delete_group'] = can_delete_group($group);
        $group['edit_group'] = can_edit_group($group);
        $group['leave_group'] = can_leave_group($group);
        $group['group_options'] = ($group['delete_group'] OR $group['edit_group'] OR $group['leave_group']);

        $groups[] = $group;
    }
Replace with:
Code:
     $groups = array();
    while ($group = $vbulletin->db->fetch_array($result))
    {
        // Only include groups whose content can be viewed.
        $group = prepare_socialgroup($group, true);
        if($group['canviewcontent'] OR $group['type'] != 'inviteonly')
        {
            $group['delete_group'] = can_delete_group($group);
            $group['edit_group'] = can_edit_group($group);
            $group['leave_group'] = can_leave_group($group);
            $group['group_options'] = ($group['delete_group'] OR $group['edit_group'] OR $group['leave_group']);

            $groups[] = $group;
        }
    }
5) In /includes/functions_socialgroup.php
Find (~ line 1893):
Code:
      return $groups;
}
Replace with:
Code:
      // Only include groups whose content can be viewed.
    $visible_groups = array();
    while($groups)
    {
        $group = prepare_socialgroup(array_shift($groups));
        if($group['canviewcontent'] OR $group['type'] != 'inviteonly')
            $visible_groups[] = $group;
    }

    return $visible_groups;
}
6) In /includes/functions_socialgroup.php
Find (~ line 1967):
Code:
       $groups = array();
    while ($group = $vbulletin->db->fetch_array($result))
    {
        $group['delete_group'] = can_delete_group($group);
        $group['edit_group'] = can_edit_group($group);
        $group['leave_group'] = can_leave_group($group);
        $group['group_options'] = ($group['delete_group'] OR $group['edit_group'] OR $group['leave_group']);

        $groups[] = $group;
    }
Replace with:
Code:
       $groups = array();
    while ($group = $vbulletin->db->fetch_array($result))
    {
        // Only show groups we can view
          $group = prepare_socialgroup($group);
        if($group['canviewcontent'] OR $group['type'] != 'inviteonly')
        {
            $group['delete_group'] = can_delete_group($group);
            $group['edit_group'] = can_edit_group($group);
            $group['leave_group'] = can_leave_group($group);
            $group['group_options'] = ($group['delete_group'] OR $group['edit_group'] OR $group['leave_group']);

            $groups[] = $group;
        }
    }
    $vbulletin->db->free_result($result);

    return $groups;
}
Note: This is marked "Unsupported" as I am not the original author; this was done by a member of my site in his spare time who is allowing the modification to be shared. This works. He simply has no time for troubleshooting.

Download Now

File Type: zip forumroot.zip (38.7 KB, 47 views)

Screenshots

File Type: jpg member.jpg (91.5 KB, 0 views)
File Type: jpg non-member.jpg (87.7 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-22-2011, 07:55 AM
HotnHoly HotnHoly is offline
 
Join Date: Feb 2005
Location: Germany
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for this solution !
Reply With Quote
  #3  
Old 07-22-2011, 03:10 PM
grey_goose grey_goose is offline
 
Join Date: Jun 2009
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very welcome, glad someone else could use it!
Reply With Quote
  #4  
Old 09-07-2015, 06:04 PM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just installed. Works like a champ.

Trying to figure out how to apply filter to the Activity Stream now.
Reply With Quote
Благодарность от:
grey_goose
  #5  
Old 09-26-2016, 09:03 PM
KevinL KevinL is offline
 
Join Date: Apr 2005
Posts: 1,287
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by smirkley View Post
Just installed. Works like a champ.

Trying to figure out how to apply filter to the Activity Stream now.
Ever figure out how to do that?
Reply With Quote
  #6  
Old 09-26-2016, 09:19 PM
grey_goose grey_goose is offline
 
Join Date: Jun 2009
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Probably just need to add the viewable permission to the stream SQL query. Unfortunately I don't use that so I can't be much help there.

maybe something like...

WHERE group.canviewcontent != 'No'
OR group.type != 'inviteonly'
Reply With Quote
Благодарность от:
KevinL
  #7  
Old 09-26-2016, 09:50 PM
KevinL KevinL is offline
 
Join Date: Apr 2005
Posts: 1,287
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you I will look into that.

Would the profile page edits be similar to what is listed here also:

https://vborg.vbsupport.ru/showthread.php?t=184715

Also trying remove the group posts from the profile activity stream. When viewing someones profile you are able to see the private groups post. Would that be similar to your last reply?

Thank you for the help!
Reply With Quote
  #8  
Old 09-27-2016, 05:34 PM
grey_goose grey_goose is offline
 
Join Date: Jun 2009
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Semi-sorta. That link will still let moderators see it (refer to can_moderate in WHERE syntax) whereas my goal was to hide them completely.

And, yes, adjusting the query would remove the private groups post.
Reply With Quote
  #9  
Old 09-15-2017, 03:58 PM
IggyP IggyP is offline
 
Join Date: May 2012
Posts: 252
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by grey_goose View Post
Semi-sorta. That link will still let moderators see it (refer to can_moderate in WHERE syntax) whereas my goal was to hide them completely.

And, yes, adjusting the query would remove the private groups post.
was this ever fully fixed/resolved?

just realized about it...kinda surprising not even vb4 got around to fixing permission issues dam..
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:53 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04811 seconds
  • Memory Usage 2,320KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (12)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (2)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (3)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete