简体   繁体   English

BuddyPress Xprofile字段显示在“ wordpress用户编辑管理面板”上

[英]BuddyPress Xprofile fields to display on “wordpress user edit admin panel”

I am using supermassive-BuddyPress theme with wordpress 3.8 and BuddyPress 1.9.I have added one additional field(Mci Number) to my registration form. 我正在使用wordmas 3.8和BuddyPress 1.9的supermassive-BuddyPress主题。我在注册表格中添加了一个附加字段(Mci编号)。 I want this xprofile field values in Wordpress user edit admin panel. 我希望Wordpress用户编辑管理面板中的xprofile字段值。

website: http://harsh031.0fees.net/register/ 网站: http//harsh031.0fees.net/register/

I tried below query and added to function.php. 我尝试下面的查询,并添加到function.php。 but ended up with nothing.Can you please help.? 但最终一无所获。能请您帮忙吗?

<?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 
}
?>

Please try below code to add the MCI Number in user profile from admin side: 请尝试使用以下代码从管理员端在用户个人资料中添加MCI编号:

function addd_new_fields($data) {
    if(!empty($data)) {
        $mciNumbar= get_user_meta($data->data->ID, 'mcinumber', true);
        ?>
        <h3>Register Additional Fields</h3>
        <table class="form-table">
            <tr>
                <th><label for="mcinumber">MCI Numbar</label></th>
                <td><input type="text" id="mcinumber" class="regular-text" value="<?php echo ($mciNumbar) ? $mciNumbar: ''; ?>" name="mcinumber"></td>
            </tr>
        </table>
        <?php
    }
}
add_action('edit_user_profile','addd_new_fields',0,1);

function save_new_fields_value($user_id) {
    if (!empty($user_id)) {
        update_user_meta($user_id,'mcinumber', $_POST['mcinumber']);
    }
}
add_action('edit_user_profile_update', 'save_new_fields_value',0,1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 BuddyPress Xprofile字段显示在“ wordpress用户编辑管理面板”上 - BuddyPress Xprofile fields to display on “wordpress user edit admin panel” Buddypress Xprofile字段和Wordpress自定义用户元2方式同步 - Buddypress Xprofile fields & Wordpress custom user meta 2 way sync Buddypress Xprofile自定义字段类型(Loop用户配置文件字段) - Buddypress Xprofile Custom Fields Type (Loop user profile field) 更新 Buddypress 用户的 xprofile 输入 - Update Buddypress user’s xprofile input 我如何在 WordPress 管理面板编辑帐户页面上显示终极会员插件的输入元字段以供管理员编辑? - how can I display ultimate member plugin's input meta fields on WordPress admin panel edit account page for editing by the admin? 隐藏buddypress注册页面中的所有Xprofile字段 - Hide all Xprofile fields from buddypress registration page wordpress 允许管理员使用自定义字段编辑用户配置文件 - wordpress allow admin to edit user profile with custom fields 如何在Wordpress管理面板中编辑页面标题? - How to edit page heading in wordpress admin panel? 将用户配置文件字段添加到Wordpress Buddypress以包括“收藏夹” - Adding User Profile Fields to Wordpress Buddypress to Include “Favorites” WordPress 管理面板中的帖子标题显示不正确 - Incorrect display of post titles in WordPress admin panel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM