Blog Archive

Monday, 5 May 2014

How to theme the User registartion form with Profile2 types ? Drupal 7 (Changing the order Or #weight of profile2 in user registration form )

You have to write the following code in your template.php file under your theme folder

/** 
 * Implement hook_theme() in your template.php file under your theme folder. 
 */ 
function YOURTHEMEFOLDERNAME_theme() { 
  $items = array();
  $items['user_register_form'] = array( 
    'render element' => 'form', 
    'path' => drupal_get_path('theme', 'YOURTHEMEFOLDERNAME') . '/templates',         'template' => 'user-register', 
    'preprocess functions' => array(                              'YOURTHEMEFOLDERNAME_preprocess_user_register' ),
    );
    return $items;
 }
 /** 
  * Preprocessor function & hook_preprocess(). 
  */ 
function YOURTHEMEFOLDERNAME_preprocess_user_register(&$vars) {
  $vars['intro_text'] = t('Get Started with a free account'); 
}

You have to write the following code in your YOURTHEMEFOLDERNAME/templates/user-register.tpl.php file under your theme templates folder [YOURTHEMEFOLDERNAME/templates/user-register.tpl.php]
<?php
    print drupal_render_children($form);
?>

You can use dsm($form); on the above file user-register.tpl.php and theme according to the style you like.

No comments:

Post a Comment