It's possible to hide email only on specified user registration form?
I've two method of creating users, I want to hide it on other one.

Comments

kenorb’s picture

Temporary I've solved it by hard-coding path condition for my own purpose:

function email_registration_form_alter(&$form, $form_state, $form_id) {
    if (module_exists('path')) { // if path module exist, translate url from alias
	$path = drupal_get_path_alias($_GET['q']);
	$arg = explode('/',drupal_get_path_alias($path));
    } else {
	$arg = arg(); // otherwise use standard one
    }
    $last_arg = $arg[count($arg)-1]; // get last argument of URI path
  switch ($form_id) {
    case 'user_register':
     if ($last_arg == 'my_last_url_path') {
      if (module_exists('profile') && is_array($form['account'])) {
        $form['account']['name']['#type'] = 'hidden';
        $form['account']['name']['#value'] = user_password();
        $form['account']['mail']['#title'] = t('E-mail');
      } 
      else {
        $form['name']['#type'] = 'hidden';
        $form['name']['#value'] = user_password();
        $form['mail']['#title'] = t('E-mail');
      }
     }
      break;

    case 'user_pass':
      $form['name']['#title'] = t('E-mail');
      $form['name']['#description'] = t('Enter your e-mail address. You\'ll be sent a new password immediately.');
      break;

    case 'user_login':
      $form['name']['#title'] = t('E-mail or login');
      $form['name']['#description'] = 'Enter your e-mail address.';
      $form['pass']['#description'] = 'Enter the password that accompanies your e-mail.';
      $form['name']['#element_validate'][] = 'email_registration_user_login_validate';
      break;

    case 'user_login_block':
      $form['name']['#title'] = t('E-mail');
      $form['name']['#element_validate'][] = 'email_registration_user_login_validate';
      break;
  }  
}

So when you will go to: /someregistrationpage/my_last_url_path, so then email will be hidden.

gate’s picture

Hello,
there is a webpage, www.emailhide.org, that encrypts your email address in a secure manner. All you nedd to do is type in your email address and is returned html code with a link with your encrypted email. I've tried and now i use it everytime. There's also a automatic gen for webmasters. Check it out.

kenorb’s picture

Thank you for the spam

Christopher Herberte’s picture

Status: Active » Closed (won't fix)