I am working on a drupal project where i in require a "Create new account" form on a content page. Can anybody help me out with this. Is there any module or any alternative to get "Create new account" as a block.
Thanks in advance.
Create a new module to add a custom block using hook_block_info and hook_block_view.
Then use this code sample:
function yourmodule_block_info()
{
$blocks = array();
$blocks['my_registerform'] = array(
'info' => t('Custom registration block'),
'cache' => DRUPAL_NO_CACHE,
);
return $blocks
}
function yourmodule_block_view($delta = "")
{
$block = array();
if($delta = "my_registerform")
{
$form = drupal_get_form("user_register_form");
$block['subject'] = t("Create new account");
$block['content'] = drupal_render($form);
}
return $block;
}
After you enable this module, a new block is created that contains drupal's registration form. Go to the block manager page admin/structure/block
to place it whenever you like.
Hope this helps.