Getting the following error when trying to edit a content type that had previously been configured with Simple Access (/admin/structure/types > Edit):

Notice: Undefined index: sa in simple_access_form_node_type_form_alter() (line 385 of .../sites/all/modules/simple_access/simple_access.module).

Comments

joekrukosky’s picture

Same here - subscribing

joekrukosky’s picture

Also get when submitting new content type:
Notice: Undefined index: simple_access in simple_access_node_type_submit() (line 397 of /home/cfwadmin/public_html/d7sites/sites/all/modules/simple_access/simple_access.module).

shadowmihai’s picture

subscribing

nuez’s picture

it appears that 'sa' is the wrong key of the array, it should be 'simple_access'.
Im not (yet ) familiar with creating patches, so i will put it just like that.

line 385:$form['simple_access'] = $tmp_form['sa'];

should be

$form['simple_access'] = $tmp_form['simple_access'];

---

now you can change the content type access, but it doesn´t work as an override. It simply gives the nodes to be created a predefined value of the access. It won´t change the access of all the nodes that already exist. It does makes sense when you think about it- it works in the same way as options like 'promoted for frontpage'. but maybe in the future there should be a ´bulk update´ option to update de access status of all the nodes belonging to a content type.

chriskd’s picture

same here...
subscrbing

melandren’s picture

Same. Subscribing.

puravida’s picture

+1
same behavior on a fresh install of D7.2 when editing any content-types.

I left the default "view" selected in settings, created access groups by role, and then created two access profiles, each one containing an access group.

As soon as I go to edit a content-type, this error is displayed.

puravida’s picture

-- last post showed up late --

stfwi’s picture

Title: Exception when editing a content type using Simple Access » Possible fix:

Hi, I check out the code, this could be the fix:

function simple_access_form_node_type_form_alter(&$form, &$form_state) {
$type = $form['old_type']['#value'];
$default = variable_get('simple_access_' . $type, array('simple_access' => array(), 'simple_access_profiles' => array(), 'simple_access_owner' => array()));

$tmp_form = simple_access_form((object)$default, TRUE);

// stfwi inserted >>>>>>
if(isset($tmp_form['sa'])) {
$form['simple_access'] = $tmp_form['sa']; // <<<<<<<<<<<< not existing
} else if(isset($tmp_form['simple_access'])) {
$form['simple_access'] = $tmp_form['simple_access']; // <<<<<<<<<<<< existing instead
} else {
debug($tmp_form);
watchdog('error', 'Simple access: form type template not existing.');
}
// <<<< stfwi inserted

$form['simple_access']['simple_access']['owner']['#parents'] = array('simple_access', 'simple_access_owner');
$form['simple_access']['#tree'] = TRUE;
$form['#submit'][] = 'simple_access_node_type_submit';
}

Jukebox’s picture

Title: Possible fix: » Exception when editing a content type using Simple Access

Just changing the title back.

damien_vancouver’s picture

Status: Active » Closed (duplicate)

There is a proper reviewed patch for this at another issue.

Even though this one came first, that one has the patch so I'm marking this one as a duplicate.

Please see: #1211002: Notice: Undefined index: sa in simple_access_form_node_type_form_alter() (line 385 of ...simple_access.module). for the patch. It's basically the change from #4 above.