No Save and Delete buttons when upgrade from 6.x-1.1 to 6.x-1.2. Have put the 6.x-1.1 back up.

Comments

stephenrobinson’s picture

In the old code (the form object) this works:

   [submit] => Array
        (
            [#type] => submit
            [#value] => Save
            [#weight] => 30
        )

    [delete] => Array
        (
            [#type] => submit
            [#value] => Delete
            [#weight] => 31
            [#submit] => Array
                (
                    [0] => user_edit_delete_submit
                )

        )

In the new code, this doesnt render the buttons:

    [submit] => Array
        (
            [#type] => submit
            [#value] => Save
            [#weight] => 30
            [#access] => 
        )

    [delete] => Array
        (
            [#type] => submit
            [#value] => Delete
            [#weight] => 31
            [#submit] => Array
                (
                    [0] => user_edit_delete_submit
                )

            [#access] => 
        )

So the empty [#access] parameter must be the issue?

stephenrobinson’s picture

As a temporary fix I did this, the buttons displayed, but no changes were saved, guess I am putting the old one back...

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if(  (arg(0)=='user')  &&  (is_numeric(arg(1)))  &&  (arg(2)=='edit')  ){ 
    if($form_id=='user_profile_form'){
      if($form['submit']){
        if($form['submit']['#access']==''){
          unset($form['submit']['#access']);
        }
      }
      if($form['delete']){
        if($form['delete']['#access']==''){
          unset($form['delete']['#access']);
        }
      }
    }
  }
}
stephenrobinson’s picture

I found these attributes missing from $form_state, which will be why nothing will save:

            [form_build_id] => form-b4daa43faf743f6d5e78fbdbfc73a41b
            [form_token] => be00fcc189a1b5ac3250faa419622026
            [form_id] => user_profile_form
Bastlynn’s picture

Thanks! This looks like it's probably related to : #1175324: Drupals formid and settings are set as access false causing user submission to fail

I'm going to apply what nzhook has on that thread to the 6.x version (accounting for differences in versions) - I suspect that will fix the problem you're seeing.

Bastlynn’s picture

Status: Active » Fixed

And that looks to be exactly what it was. The fix has been rolled into the 6.x branch.
Let me know if you see trouble with it.

roball’s picture

Yes I can confirm the problem with 1.2 and that 1.3 fixed it.

Bastlynn’s picture

Status: Fixed » Closed (fixed)
doublejosh’s picture

StatusFileSize
new7.88 KB

I'm on 7.x-1.3 and the submit/cancel buttons are still included in the list of elements to restrict.
This means if the default if to disable fields the buttons will just not show.

However you can always just update the settings for the button elements, so perhaps this was the intention.