We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Extension: Restrict Entries (to Member Groups or Guests)

Development and Programming

Angie Herrera's avatar
Angie Herrera
357 posts
15 years ago
Angie Herrera's avatar Angie Herrera

Yep - figured that out eventually. 😊 Thanks!

       
Angie Herrera's avatar
Angie Herrera
357 posts
15 years ago
Angie Herrera's avatar Angie Herrera

Would really love a way to display a message if the content is restricted. Any ideas / thoughts?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen
Very, very useful extension. Thanks a LOT! I hope you don’t mind, but I also wanted the permissions to work the other way around (as per Mark’s request) and have come up with following tweak for those that are interested until you have time to make a full update. Change at line 257 of ext.restrict_entries.php from
foreach($SESS->cache['restricted_member_group_data']->result AS $key)
        {            
            if ($key['entry_id'] == $row['entry_id'])
            {
                $groups = unserialize($key['member_groups']);
                
                foreach($groups AS $key => $value)
                {
                    if($SESS->userdata['group_id'] == $value)
                    {
                        $tagdata = '';
                        break;
                    }
                }
            }
        }
to
foreach($SESS->cache['restricted_member_group_data']->result AS $key)
        {            
            if ($key['entry_id'] == $row['entry_id'])
            {
                $groups = unserialize($key['member_groups']);
                $ok=FALSE;
                foreach($groups AS $key => $value)
                {
                    if($SESS->userdata['group_id'] == $value)
                    {
                        $ok=TRUE;
                        break;
                    }
                }
                if ($ok===FALSE && $SESS->userdata['group_id']!=1){
                    $tagdata = '';
                }
            }
        }
Also change line 12 of lang.restrict_entries.php from
"Select the groups that you wish to prevent from viewing this entry",
to
"Select the groups that you wish to allow to view this entry",
Super-Admins will always get to see everything.

I just revisited this thread today and tried this update but I can’t get it to work around the other way. In fact placing this code in doesn’t do anything now. Instead of the check-boxes actually doing anything, now no matter if I choose a checkbox or don’t the entries just show to everyone regardless.

Has anyone any ideas on this as I do have a need for this now and would really need it to work around the other way.

Greg any ideas at all?

Thanks.

Best wishes,

Mark

       
Jordan Moore's avatar
Jordan Moore
45 posts
15 years ago
Jordan Moore's avatar Jordan Moore

Hello Greg,

I found this excellent extension thanks to the ever-helpful Mark Bowen. I have two issues however - is the extension MSM compatible? And also there seems to be a conflict with Leevi’s NSM Publish Plus on the Edit screen - the Restricted Entries table column seems to hide the Workflow State column (with the coloured circles showing entry states).

Many thanks, Jordan

       
First 3 4 5

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.