drvvvuyia15070493 2015-11-02 16:29
浏览 66

在注册时隐藏BuddyPress中的“名称”字段

I am using wordpress multisite and I want to hide the field name at the registration. The following code might work on single site but definitely does not work on multisite. How can we make it work on Multisite?

In your CSS:

div.field_1{
    display:none;
}

In your bp-custom.php or functions.php:

function buddydev_disable_firstname() {
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function(){

            var jq=jQuery;

            jq("#signup_username").on("blur",function(){

                jq("#field_1").val(jq("#signup_username").val());

            });

        });
    </script>
    <?php
}
add_action( 'bp_after_register_page', 'buddydev_disable_firstname');
  • 写回答

1条回答 默认 最新

  • doureng1083 2015-11-02 17:21
    关注

    If you look into wp-login.php source, you'll see that Wordpress make a special redirection for multisite installations:

    if ( is_multisite() ) {
        wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
        exit;
    }
    

    So if you look in that file, you'll see that the user name is display in this way:

    echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />';
    

    Then to hide the field + the label, you need to write:

    label[for="user_name"], input[name="user_name"] {
        display: none;
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?