I want to assign class name to Create new account and Request new password links separately. i'm using sub-theme of Omega. Is it possible? If yes then how?

Comments

VM’s picture

as the login block is a form I'd start by looking into a hook_form_alter in a custom module. You can also look to see if there is a theme function associated with the block in the user.module and override it in your template.php file.

dhineshkumar’s picture

I have tried something to set custom class name to textfields in user login block by adding following code to my omega subtheme's template.php file :

function creativpink_form_alter(&$form, &$form_state, $form_id, $element) {
    if ( TRUE === in_array( $form_id, array( 'user_login', 'user_login_block') ) ) {
        $form['name']['#attributes']['class'] = array('class1', 'class2');
        $form['pass']['#attributes']['class'] = array('class3', 'class4');
        $form['actions']['submit']['#attributes']['class'] = array('class5', 'class6');
     }
}

Also I'm using ajax_register module for login purpose. I added $options['attributes']['class'] = 'custom-class1'; code above to $options['attributes']['title'] = t('Create new account'); (this code found on line no. 405) for testing purpose. Then class name was assigned to Create new account link. I think this is wrong approach.

I don't know how set class name to Create new account and Request new password links. Please help me how to move further.