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

New Extension: Entry Permissions

Development and Programming

bobh's avatar
bobh
145 posts
15 years ago
bobh's avatar bobh
This look like a very useful extension and may solve some of our permissioning problems. Just one minor issue; the extension settings will not save when I submit. Any ideas as to what I may have missed? Thanks.

I had the same problem. You need to update with the file attached to this post.

There still are some issues here I noticed: - weblog entries to which I have given a certain group full access to are not showing up in the edit section. I can post new ones though. - in stead of a “you are not authorised” message, I would like that particular weblog to be removed from the publish tab. - a blank page appears when adjusting the extension settings - in firefox I get this error:

Notice: Undefined variable: r in /xxx/public_html/xxx/extensions/ext.entry_permissions.php on line 420
       
bobh's avatar
bobh
145 posts
15 years ago
bobh's avatar bobh

Oh, and the zip on your website says v1.1 but it really has v1.0 in it.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

Thanks, I’ll look into it.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

I fixed the Undefined Variable error, but the settings don’t appear to be saving…

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

Ok, I’ve updated to 1.2. Should have fixed the error with the settings not saving, and the undefined variable. Let me know if you’re still getting the error where entries are not showing in the edit list.

Get the latest version: http://www.brianlitzinger.com/ee/

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

Here is something you can add to the Stucture module that will remove the link from pages that the current user doesn’t have permission to edit.

in modules/structure/tpl/structure_admin.tpl.php

Modify the following chunk of code:

<?php if( $entry_permissions and !$entry_permissions->_check_editing_permissions($eid, $site_id, $entry['weblog_id']) ): ?>
                                    <span class="pageTitle"><?php echo $entry['title']; ?></span>
                                <?php else: ?>
                                    <a href="http://<?php" title="Edit page" class="pageTitle">_                                        <?php echo $entry['title']; ?>_                                    </a>
                                    <?php if ($view_add_page): ?>
                                    <a href="http://<?php" title="Add child page" class="addPage"> _                                         +add page _                                    </a>
                                    <?php endif; ?>
                                    <?php if ($entry['listing_wid']): ?>
                                    <span class="addEdit">
                                        <span class="addEditLabel">Entries: </span>
                                        <a href="http://<?php">; ?>" title="Add an entry to this page."]Add</a> 
                                         / 
                                        <a href="http://<?php">; ?>" title="Edit an entry on this page."]Edit</a>
                                    </span>
                                    <?php endif; ?>
                                <?php endif; ?>

and in modules/structure/mcp.structure.php in the admin method, add the following code somewhere before the ob_start():

$entry_permissions = false;
        $entry_permissions_query = $DB->query("SELECT class, settings FROM exp_extensions WHERE class = 'Entry_permissions' AND enabled = 'y' LIMIT 1");
        if($entry_permissions_query->num_rows == 1)
        {
            require(PATH_EXT.'ext.entry_permissions.php');
            $entry_permissions = new Entry_permissions;
        }

This is an unsupported hack, but has worked for me on a previous project.

       
bobh's avatar
bobh
145 posts
15 years ago
bobh's avatar bobh

Ok, I installed 1.2 but:

  • I still get a blank page (well, the EE cp style is there but that’s all)
  • logged in as super admin the edit page AND the publish page is broken. here’s the error:
Notice: Undefined variable: field_id in /home/xxx/public_html/xxx/extensions/ext.entry_permissions.php on line 701
MySQL ERROR:

Error Number: 1054

Description: Unknown column 'field_id_' in 'field list'

Query: SELECT field_id_ AS field FROM exp_weblog_data WHERE entry_id = '13' AND weblog_id = '5' AND site_id = '1'
       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

Ok, just updated to 1.2.1. Get the file from the original post, or at http://www.brianlitzinger.com/ee/

It was an issue where it tried to see if you had permissions to edit an entry, but you hadn’t created the Member Group field yet. So if that field type doesn’t exist, it just returns true and the entry is editable.

Hope to god the bugs are squashed now… for my first extension this one had a few…

       
bobh's avatar
bobh
145 posts
15 years ago
bobh's avatar bobh

‘Fraid not… The settings are not sticking, the empty screen is still there after submitting settings.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

I thought I already fixed that one…

I’ll take a look again…

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

Updated to 1.2.2. All I changed was a priority from 1 to 2, because it doesn’t have to be a 1. Uninstall the extension, and go into the DB and actually remove all the hooks from the exp_extensions table for Entry_permissions. There was an old hook that was called on session_end that didn’t need to be called. Once I removed that a couple versions ago I didn’t have that problem anymore. Right now the extension works perfectly for me in my sandbox environment. If it’s still not working for you send me a list of all the extensions you have installed.

       
bobh's avatar
bobh
145 posts
15 years ago
bobh's avatar bobh

Well alright, that did it, thanks Brian. I’d still prefer the restricted weblog(s) not showing up in the publish tab in stead of that ‘not authorised’ message but I’m happy nonetheless.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

I’ll try to get around to removing the weblogs from the Publish tab… I just want to get what code base is there bug free first 😊

       
Charles66's avatar
Charles66
4 posts
15 years ago
Charles66's avatar Charles66

Sorry for my bad English. I installed the extension. But when I do the settings, then when I click SUBMIT, I get a blank page and I do not take the settings. I had previously created a field on the weblog, which attracts a group. I do not understand why. I checked the file permissions and I have set to 644.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
15 years ago
Brian Litzinger's avatar Brian Litzinger

Charles66, are you using version 1.2.1? If so did you install a previous version? There was an issue where I was using an unnecessary hook that caused the blank screen, which I removed, and haven’t had the blank screen since. If you ARE using 1.2.1 let me know and I’ll look into it again.

       
1 2 3 4

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.