I saw this on emf and I think it's an useful feature to have. I have defined an username field on the mailchimp list and I don't want that to be shown to either anon or auth users. Also, I'd like the name field to be displayed only for anon users.

I will try to contribute a patch for this thing.

Comments

netentropy’s picture

use hook_form_alter from the Drupal api

hanoii’s picture

yeah well, it might be nice to have such a feature in a module for non-developers and to keep the module as flexible as possible.

levelos’s picture

Status: Active » Closed (won't fix)

Great idea, but I think it's a fairly fringe use case, and the interface is already very busy, this would make it more so. I'll consider a patch, but am hesitant to include this. Indeed, it's exactly what hook_form_alter() is for.

hanoii’s picture

Status: Closed (won't fix) » Postponed

I don't mind throwing a form_alter in a module, but again, that's something that I will do and will not help anybody else. But as you say, it might just be me who needs it. I'd think the issue is better to leave it as postponed so it can be found and eventually, if others needs this, we can resume discussion. I guess if your position is not to include such a feature, I will do it as my own module.

levelos’s picture

Agreed on leaving it postponed. If you want to submit a patch, for that matter, I'd be happy to consider for inclusion. Thanks.

KMNL’s picture

Often I want to sync user profile info once they complete the registration process, but in the sidebar, only the email is required. (I'd prefer to not use CSS to hide elements). Hook form alter sounds like a temp fix to me.

davepoon’s picture

You can easily create a custom module using form_alter hook to hide the fields you don't want in a form,
find out the form ID, find out the fields in the array you want to hide,
you can use dsm($form) if you are using devel module, or simply use print_r($form) to print out the array.

The following code sample is to hide the first name and last name fields in the subscription block.

<?php
  function YOURMODULENAME_form_alter(&$form, $form_state, $form_id) {
    switch ($form_id) {
      case 'MAILCHIMP FORM ID':
		unset($form['mailchimp_lists']['RAMDOM NUMBER']['FNAME']);
		unset($form['mailchimp_lists']['RAMDOM BUMBER']['LNAME']);
        break;
    }
  }
?>
Michsk’s picture

Component: Code » General

actually its

  function YOURMODULENAME_form_alter(&$form, $form_state, $form_id) {
    switch ($form_id) {
      case 'MAILCHIMP FORM ID':
        unset($form['mailchimp_lists']['RAMDOM NUMBER']['mergevars']['FNAME']);
        unset($form['mailchimp_lists']['RAMDOM BUMBER']['mergevars']['LNAME']);
        break;
    }
  }
Michsk’s picture

mm, actually that doesn't work.

Michsk’s picture

lol, seems i forgot to reference the $form in the function.

function mailchimp_hacks_form_alter(&$form, $form_state, $form_id) {
    if ($form_id === 'mailchimp_lists_user_subscribe_form_sign_up_for_our_newsletter') {
        $form['mailchimp_lists']['mailchimp_sign_up_for_our_newsletter']['mergevars']['FNAME']['#access'] = false;
        //dsm($form);
    }
}
levelos’s picture

This feature is now available in 2.11.

levelos’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.