【发布时间】:2013-12-29 14:16:13
【问题描述】:
我正在使用带有 wordpress 3.8 和 BuddyPress 1.9 的超大规模 BuddyPress 主题。我在我的注册表单中添加了一个额外的字段(Mci 编号)。 我想要 Wordpress 用户编辑管理面板中的这个 xprofile 字段值。
网址:http://harsh031.0fees.net/register/
我尝试了以下查询并添加到 function.php。但最终一无所获。你能帮忙吗?
<?php
add_action( 'show_user_profile', 'showmy_extra_profile_fields' );
add_action( 'edit_user_profile', 'showmy_extra_profile_fields' );
function showmy_extra_profile_fields( $user ) { ?>
<h3>Extra profile information</h3>
<table class="form-table">
<tr>
<th><label>Mci Number</label></th>
<td>
<?php
if( function_exists( 'xprofile_get_field_data' ) ) {
$xprofile_value = xprofile_get_field_data('Mci Number', $user->ID );
}
else {
$xprofile_value = '';
}
?>
<input type="text" name="Mci Number" id="Mci Number" value="<?php echo esc_attr( $xprofile_value ); ?>" class="regular-text" readonly />
</td>
</tr>
</table>
<?php
}
?>
【问题讨论】:
标签: wordpress field admin buddypress