大佬教程收集整理的这篇文章主要介绍了wordpress 允许用户使用自定义字段编辑用户个人资料,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 custom-fIElds.php 文件中有一个带有按钮的表单。当用户提交表单时,它应该更新其用户个人资料中的自定义字段。
问题 1:表单似乎已提交,但变量 ($sent) 未更新 wordpress 用户配置文件。 问题二:提交表单时页面重定向。
我已经创建了一个变量并在 custom-fIElds.php 中设置了表单:
<?php $sent = get_user_R_917_11845@eta($user_iD,'payment-sent',truE); ?>
<form action="custom-fIElds.php" method="get">
<div class="fIEld">
<label for="payment-sent">Have you sent the payment?</label>
<SELEct ID="payment-sent" name="payment-sent" size="">
<option value="no" <?php SELEcted($sent,'not_sent')?>>
No,I have not sent payment yet</option>
<option value="yes" <?php SELEcted($sent,'sent')?>>
Yes,payment is sent</option>
</SELEct>
</div>
<span class="button"><input type="submit"></span>
</form>
<?php
//create custom fIElds
add_action('show_user_profile','wk_custom_user_profile_fIElds');
add_action('edit_user_profile','wk_custom_user_profile_fIElds');
function wk_custom_user_profile_fIElds($user)
{
$sent = get_user_R_917_11845@eta($user->ID,truE);
?>
//custom fIEld HTML
<tr>
<th><label for="payment-sent">Payment Sent</label></th>
<td>
<input type="text" value="<?php echo $sent ?>" Readonly="Readonly">
</td>
</tr>
<?php
}
//Save custom user profile Meta data fIElds
add_action('personal_options_update','wk_save_custom_user_profile_fIElds');
add_action('edit_user_profile_update','wk_save_custom_user_profile_fIElds');
function wk_save_custom_user_profile_fIElds($user_iD)
{
if (!current_user_can('edit_user',$user_iD)) {
return false;
}
update_user_R_917_11845@eta($user_iD,$_POST['payment-sent']);
}
?>
@H_618_0@解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的wordpress 允许用户使用自定义字段编辑用户个人资料全部内容,希望文章能够帮你解决wordpress 允许用户使用自定义字段编辑用户个人资料所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。