I created a new List and set it to "Allow anonymous registrations. (Formerly "Freeform List")"

The block is show fine for anonymous users but the Email input is not shown for authenticated users.

Take a look a the capture:

capture

CommentFileSizeAuthor
#2 2216405-2-hack.patch3.03 KBjoelpittet
mailchimp.jpg26.72 KBchefnelone

Comments

joelpittet’s picture

Version: 7.x-2.12 » 7.x-2.x-dev

I too find this strange. This may be a feature request, the normal use case should likely be the anonymous E-mail field. This would help with theming this block as you'd know what to expect in all conditions. Though maybe there is some feature that this change is providing.

So at the very least the block should have an option to turn on this checkbox list when logged in?

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new3.03 KB

Maybe there needs to be a separation of responsibilities for the form building between the blocks that are generated and the registration/user/etc forms?

I tried a form_alter which didn't seem to work out so well but here's the code if it helps... Seems the submit hooks aren't firing as I'd expect.

function MODULE_form_alter(&$form, &$form_state, $form_id) {
  if (!empty($form['mailchimp_lists'])) {
    $children = element_children($form['mailchimp_lists']);
    foreach ($children as $wrapper_key) {
      // Build up anonymous input form field for all.
      $list_form =& $form['mailchimp_lists'][$wrapper_key];
      $list = $list_form['list']['#value'];
      $mergevalues = NULL;
      $mc_list = mailchimp_get_list($list->mc_list_id);
      if (!empty($mc_list['mergevars'])) {
        foreach ($mc_list['mergevars'] as $mergevar) {
          if (!empty($list->settings['mergefields_display'][$mergevar['tag']])) {
            $list_form['mergevars'][$mergevar['tag']] = mailchimp_lists_insert_drupal_form_tag($mergevar);
          }
        }
      }

      // Remove subscribe field.
      unset($list_form['subscribe']);
    }
  }
}

Also considering do this for a quick fix.
http://drupal.stackexchange.com/questions/96249/create-custom-signup-blo...

joelpittet’s picture

This is related to this issue #2208527: Checkbox vs. form-text for authenticated users if not a duplicate.

joelpittet’s picture

Status: Needs review » Closed (duplicate)

Duplicate of also #2051273: Signup fields missing? which seems to have a patch that's worth trying. Closing this as a duplicate.