我在html中创建了一个表单,如下所示:
<form class="login active">
<h3>Login</h3>
<div>
<label>Username:</label>
<input type="text" name="username"/>
</div>
<div>
<label>Password: </label>
<input type="password" name="password"/>
<label><a href="forgot_password.html" rel="forgot_password" class="forgot linkform">Forgot your password?</a></label>
</div>
<div class="bottom">
<div class="remember"><!--<input type="checkbox" />--><span><!--Keep me logged in--></span></div>
<input type="submit" value="Login"></input>
<a href="register.html" rel="register" class="linkform">You don't have an account yet? Register here</a>
<div class="clear"></div>
</div>
</form>
我需要做的是让用户使用我的html表单登录Drupal。提前致谢
答案 0 :(得分:0)
在template.php中写道:
<?php
function mytheme_theme(&$existing, $type, $theme, $path) {
$hooks['user_login'] = array(
'template' => 'templates/user_login',
'render element' => 'form',
// other theme registration code...
);
return $hooks;
}
function mytheme_preprocess_user_login(&$variables) {
$variables['intro_text'] = t('This is my awesome login form');
$variables['rendered'] = drupal_render_children($variables['form']);
}
?>
然后,您可以在目录user_login.tpl.php
中创建templates
。
答案 1 :(得分:0)
使用hook_menu
注册自定义模块的自定义路径可以解决您的问题:https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu/7
之后,只需使用user_authenticate
等功能对用户进行身份验证:https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_authenticate/7
这两个链接都为您提供了示例。