Simplenews 6.x-2.x hook_user adds #submit element for user_profile_form

  $form['#submit'][] = 'simplenews_subscriptions_account_form_submit';

And in some way it breaks submittion of all form.

for now I just commented this part of code in function onepageprofile_user:

        

        // Other modules
        /*if (module_exists('simplenews')) {
          $simplenews_form = simplenews_user('form', $edit, $account, 'newsletter');
          if (is_array($simplenews_form)) {
            $form += $simplenews_form;
          }
        }*/

Comments

pacufist’s picture

Fixed in own module. Just need to add missed default submit function.

// hook_form_ID_alter
function module_form_user_profile_form_alter(&$form){
      
      if(module_exists("simplenews")){
          if(array_search('user_profile_form_submit',$form['#submit']) === false){
              $form['#submit'][] = 'user_profile_form_submit';
          }
      }

}
neurovation.kiwi’s picture

This one is a duplicate of http://drupal.org/node/895568
or vice versa ;)

aidanlis’s picture

Status: Active » Closed (duplicate)
neurovation.kiwi’s picture

Status: Closed (duplicate) » Needs review

Hi aidanlis!

seems u used that fix, but it has a problem.

sometimes $form['#submit'] is not an array, and then array_search triggers an PHP -Error, which is kind of annoying. (it doesn't do any harm except filling up the watchdog-table).

so please change the line #105 from

if (array_search('user_profile_form_submit', $form['#submit']) === FALSE) {

to

if (is_array($form['#submit']) && array_search('user_profile_form_submit', $form['#submit']) === FALSE) {

thx
kiwi