ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Safecracker, Edit Existing Entries With Restricted Author Access

March 29, 2012 12:05pm

Subscribe [2]
  • #1 / Mar 29, 2012 12:05pm

    Wes McWhorter

    36 posts

    Man, I’ve been battling with this for two days now, and am at my wit’s end. First of all, let me lay out the landscape of my set-up.

    • EE v2.4.0 - Build: 20120123
    • Safecracker 2.1
    • Using .htaccess to remove index.php from URL string
    • Admin > General Config > Name of your site’s index page is blank
    • Custom Member Group for “Retailers” that have members who are allowed to post in Channels called “Retailers” and “Workshops”
    • Each entry in the above channels is assigned to these members as “Authors”

    On the front end, I have created a simple member login form that allows them access those entries that are specifically assigned to them for editing. Will also be allowing them to create new entries, but that’s not the focus of my issue here.

    The problem is, that when a user logs in, is presented with the list of entries available to them, selects the entry they want to edit and the form loads up, issues start to arise. They are as follows:

    1. When the page completes loading, the following error gets generated in Firebug:

    Timestamp: 3/29/12 10:42:40 AM
    Error: b is null
    Source File: <a href="http://www.mydomain.com/?ACT=7&ui=core,widget,mouse,position,draggable,resizable,sortable,button,dialog,datepicker&plugin=scrollable,scrollable.navigator,ee_filebrowser,ee_fileuploader,markitup,thickbox,toolbox.expose,overlay,tmpl&file=json2&v=1332968175&include_jquery=y">http://www.mydomain.com/?ACT=7&ui=core,widget,mouse,position,draggable,resizable,sortable,button,dialog,datepicker&plugin=scrollable,scrollable.navigator,ee_filebrowser,ee_fileuploader,markitup,thickbox,toolbox.expose,overlay,tmpl&file=json2&v=1332968175&include_jquery=y</a>
    Line: 677

    2. If I include the Title field and URL title field in the form, the onkeyup=“liveUrlTitle();” function throws an error in Firebug, and doesn’t update the url-title field (naturally).

    3. If I remove the content of a required field (in the example below the “retailer_email_address” field) and submit the form, I am returned to the same page (expected), but no errors are displayed.

    4. If all the necessary fields are filled and completed (perhaps editing something like “retailer_contact_name” to cause a change), and I submit the form, I am STILL redirected back to the same form, and no changes are made to the entry.

    I’ve been all over the Safecracker docs, searched this forum for hours, dug through bug reports and everything else I can think of, but still this thing is not working.

    To add a context, let’s say the URL in question is this:

    http://www.anniesloanunfolded.com/private_2012/locations/edit/3-oaks-studio

    A simplified version of my form looks like this:

    {exp:safecracker 
    id="acctMgmtForm" 
    channel="retailers"
    return="{segment_1}/complete"
    url_title="{segment_4}" 
    error_handling="inline"
    preserve_checkboxes="yes"
    use_live_url="no"
    author_only="yes"
    rules:retailer_email_address="required"
    }
      <fieldset>
        {if field_errors:count >= 1}
          <div class="formErrors">{field_errors}<span class="error">{error}</span><br>{/field_errors}</div>
        {/if}
        <label for="title">Company Name (or contact name if not a business)</label>
        <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" />
        <label for="url_title">URL Title (Read Only)</label>
        <input type="text" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50" readonly="readonly" />
        <label for="retailer_contact_name"> Your Name:</label>
        <input type="text" name="retailer_contact_name" value="{retailer_contact_name}" />
        <label for="retailer_email_address"><span>*</span> Email Address:</label>
        <input type="text" name="retailer_email_address" value="{retailer_email_address}" />
      </fieldset>
      <input class="button" type="submit" name="submit" value="Save Changes" />
    {/exp:safecracker}

    Hopefully this provides whomever picks this up with a good amount of info from which to provide suggestions. For EE staff, I’m also willing to PM control panel access and a login to the front-end to help troubleshoot any of these issues from within.

    Thanks in advance for any help or perspective. If I can get this issue solved, it should allow me to replicate the method to a few other areas of admin I have scheduled for these users.

  • #2 / Mar 29, 2012 12:36pm

    glenndavisgroup

    436 posts

    Hi Wes McWhorter,

    Try adding ID=”” to your custom fields. See if that helps.


    Mike

  • #3 / Mar 29, 2012 1:09pm

    Wes McWhorter

    36 posts

    Hey Mike,
    Not sure exactly what you mean. Think you could clarify a bit more?
    ~
    W

  • #4 / Mar 29, 2012 1:27pm

    glenndavisgroup

    436 posts

    Hi Wes,

    Try this:

    <label for="retailer_contact_name"> Your Name:</label>
    <input type="text" id="retailer_contact_name" name="retailer_contact_name" value="{retailer_contact_name}" />
    <label for="retailer_email_address"><span>*</span> Email Address:</label>
    <input type="text" id="retailer_email_address" name="retailer_email_address" value="{retailer_email_address}" />

    Mike

  • #5 / Mar 29, 2012 2:24pm

    Wes McWhorter

    36 posts

    Okay Mike,
    Did that, cleared cache, logged out, logged back in, tried to edit the entry, and the same issues as I posted originally are present. Basically, no change. Though the ID suggestion is smart. My bad on that one.

    ~
    Wes

  • #6 / Mar 29, 2012 4:10pm

    glenndavisgroup

    436 posts

    Do you have any third party plug-ins installed?


    Mike

  • #7 / Mar 29, 2012 4:20pm

    Wes McWhorter

    36 posts

    Modules:
    Channel Images (5.1.4)
    DataGrab (1.7.0)
    Deeploy Helper (2.0.3)
    Freeform (3.1.1)
    Low Reorder (1.2.1)
    Low Variables (1.3.3)
    Protected Links (1.6.8)
    Super Search (1.4.4)
    Zenbu (1.5.2)

    Accessories:
    MX Extended Content Menu (1.0.3)
    MX Title Control (2.1.2)

    Fieldtypes:
    Channel Images (5.1.4)
    Geotagger (3.04)
    Matrix (2.2.4)
    Playa (4.1.0.3)
    REEgion Select (2.0.4)

  • #8 / Mar 29, 2012 4:22pm

    Wes McWhorter

    36 posts

    Incidentally, Channel Images, REEgoin Select and Geotagger are the only “non-standard” fieldtypes in use for that particular set of channel fields.

  • #9 / Mar 29, 2012 4:40pm

    glenndavisgroup

    436 posts

    Have you checked to see if there are any updates for all these add-ons you are using? I would recommend doing so just to make sure it’s not something they are breaking. I’m not really familiar with a lot of those add-ons as I never had the need to use them yet. Your code looks correct but still not sure why its not working? I think you might have to wait for an EE dev to help you with this. Sorry I couldn’t be of more help.

    Mike

  • #10 / Mar 29, 2012 5:25pm

    ahmad saad

    364 posts

    I think your problem in remove index.php

    try return the index.php and check it.

    if the problem resolved we will talk about .htaccess

  • #11 / Mar 30, 2012 2:36pm

    Dan Decker

    7338 posts

    Hi Wes,

    I’m sorry you are having so much trouble with SafeCracker! It is a squirrelly beast sometimes.

    I need you to try 2 things for me. Take out the use_live_url=“no” parameter, just for testing. The User Guide seems to indicate that this is only needed if you have disabled the SafeCracker Head code with safecracker_head=“no”

    Next, as Ahmad has suggested, let’s eliminate .htaccess as a culprit here. Disable or rename your .htaccess and add index.php back into the General Configuration.

    Test each of those scenarios and let me know the results. When you reply, please include the contents of your .htaccess directives so we can get a look at those as well.

    I look forward to your response!

    Cheers,

  • #12 / Apr 02, 2012 3:33pm

    Wes McWhorter

    36 posts

    Dan,
    Thanks for the response. Still in the same place as I was originally. I had thought the removal of index.php might be an issue, but when I disable .htaccess and add index.php back in, I’m met with a message that says “No input file specified.”.

    My .htaccess contains this:

    # Rewrite rules for Expression Engine
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]

     

  • #13 / Apr 02, 2012 3:39pm

    Wes McWhorter

    36 posts

    Okay, so in searching for “No Input File Found”...I came across this post:

    http://ellislab.com/forums/viewthread/213122/

    I went into my Control Panel and under Admin->System Administration->Output and Debugging->“Force URL query strings” and enabled that…

    BAM! All of a sudden, it SEEMS to be working. I’l at least say that I have taken a step forward. I’m not ready to call this completely solved, but at least I’m unstuck for a moment.

    ~
    W

  • #14 / Apr 05, 2012 11:08am

    Shane Eckert

    7174 posts

    Hey Wes,

    Glad to hear it. How are things going now? you still good?

    Cheers,

  • #15 / Apr 05, 2012 4:32pm

    Wes McWhorter

    36 posts

    Still good. Been continuing my development and everything seems good. If you guys want to go ahead and close this thread, I think you can. Appreciate the help from all!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases