使用用户元自动填充文本输入 - 电子邮件
Auto fill text inputs with user meta - email
我有一个不使用任何插件制作的表格,我正在寻找一种方法来查看用户是否已登录,获取他们的电子邮件地址,然后填写该字段:
<tr><td><span style='nowrap:nowrap;font-size:15px;font-family:Arial;width:200px;line-height: 22px;'>Email'</span><br><input type='text' maxlength='100' style='width:250px;' name='Email'></input></td></tr>
我会使用插件,但必须有一种不使用任何插件的方法。由于表单不是使用插件制作的,因此 CF7 动态文本扩展对我(但我认为)或重力表单不起作用。
提前致谢。
获取当前 get_currentuserinfo 获取电子邮件的功能。
检查代码。
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
$user_email = $current_user->user_email;
} else{
$user_email = " " ;
}
?>
<input type='text' maxlength='100' value="<?php echo $user_email ?>" style='width:250px;' name='Email'>
我有一个不使用任何插件制作的表格,我正在寻找一种方法来查看用户是否已登录,获取他们的电子邮件地址,然后填写该字段:
<tr><td><span style='nowrap:nowrap;font-size:15px;font-family:Arial;width:200px;line-height: 22px;'>Email'</span><br><input type='text' maxlength='100' style='width:250px;' name='Email'></input></td></tr>
我会使用插件,但必须有一种不使用任何插件的方法。由于表单不是使用插件制作的,因此 CF7 动态文本扩展对我(但我认为)或重力表单不起作用。 提前致谢。
获取当前 get_currentuserinfo 获取电子邮件的功能。
检查代码。
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
$user_email = $current_user->user_email;
} else{
$user_email = " " ;
}
?>
<input type='text' maxlength='100' value="<?php echo $user_email ?>" style='width:250px;' name='Email'>