Love the work you've done on this module.
I made this mod on my end and thought I might share it with you for future consideration.
For Always Expanded options in logintoboggan.module
replace line #436
'#options' => array(t('Link'), t('Collapsible Form')),
with
'#options' => array(t('Link'), t('Collapsible Form'), t('Simple Form')),
replace lines #457-469
if (variable_get('toboggan_block_type', 1) == 1) {
// A temporary hack to make sure the user login block itself doesn't get altered as well
$_POST['logintoboggan']['login_block'] = TRUE;
// Calling the user login block here directly in order to be able to use the form and alter it for our needs.
// We also have to unset the ugly title from the user block
$block = user_block('view', 0);
unset($block['subject']);
}
else {
$block['content'] = l(t('Login/Register'), 'user/login', array(), drupal_get_destination());
}
with
switch (variable_get('toboggan_block_type', 1))
{
case "1": // Collapsed
case "2": // Always Expanded
// A temporary hack to make sure the user login block itself doesn't get altered as well
$_POST['logintoboggan']['login_block'] = TRUE;
// Calling the user login block here directly in order to be able to use the form and alter it for our needs.
// We also have to unset the ugly title from the user block
$block = user_block('view', 0);
unset($block['subject']);
break;
default:
$block['content'] = l(t('Login/Register'), 'user/login', array(), drupal_get_destination());
}
then replace the entire _logintoboggan_toggleboggan function with
switch (variable_get('toboggan_block_type', 1)
{
case "1": // Collapsed
$pre = '<div id="toboggan-container">';
$pre .= l(t('Login/Register'), 'user/login', array('onclick' => "toggleboggan('toboggan-login');this.blur();return false;"));
//Grab the message from settings if there is one to display at the top of the login block.
if ($login_msg = variable_get('toboggan_block_msg', '')) {
$pre .= '<div>'. $login_msg .'</div>';
}
//the block that will be toggled
$pre .= '<div id="toboggan-login" class="user-login-block">';
$form['pre'] = array('#value' => $pre, '#weight' => -300);
$post .= '</div></div>';
//javascript toggle function
$post .= '<script type="text/javascript">';
// <![CDATA[
$post .= 'function toggleboggan($id) {';
$post .= '$obj = document.getElementById($id);';
$post .= '$obj.style.display = ($obj.style.display == \'none\') ? \'block\' : \'none\';}';
// for compatibility with non-js browsers:
$post .= 'document.getElementById(\'toboggan-login\').style.display = \'none\';';
// ]]>
$post .= '</script>';
break;
case "2": // Always Expanded
//the block that will be toggled
$pre .= '<div id="toboggan-container" class="user-login-block">';
$form['pre'] = array('#value' => $pre, '#weight' => -300);
$post .= '</div>';
break;
}
$form['post'] = array('#value' => $post, '#weight' => 300);
return $form;
As an added bonus, the theme hook for this is easily added in by
replacing the function _logintoboggan_toggleboggan name with theme_lt_login and adding the following function
function _logintoboggan_toggleboggan ($form) {
$block['content'] = theme('lt_login', $form);
return $block;
}
I hope this makes everyones lives a little bit easier!
Cheers.
Comments
Comment #1
wilco commentedBug fix on the theme function should look like this:
Removed the
['content']pointer.-w
Comment #2
hunmonk commentedplease submit this as a patch to the module, in unified diff format, if you'd like it to be considered for inclusion.
Comment #3
hunmonk commentedissue looks dead to me. please feel free to reopen if you reproduce and actual patch file ;)