【问题标题】:Add extra fields to profile page向个人资料页面添加额外字段
【发布时间】:2012-11-22 10:00:15
【问题描述】:

我正在使用插件theme-my-logintheme my profile 来创建前端登录/注册过程。

当用户在网站上注册时,他们会被重定向到他们的个人资料页面。虽然我的登录主题带有向注册表单添加额外字段的功能,但我如何向个人资料表单添加额外字段?

要显示和更新配置文件,我有短代码[theme-my-profile],它在前端显示用户配置文件。

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    试试这个代码

    add_filter('user_contactmethods', array(&$this, 'add_contactmethods'), 10, 1);
    
    /**
     * Add another contact field to the user profile page
     *
     * @param array $contactmethods
     * @return array
     */
    function add_contactmethods( $contactmethods ) {
        // Add Twitter
        $contactmethods['twitter'] = __('Twitter Username', 'twitter-avatar-reloaded');
        return $contactmethods;
    }
    

    PS:我从Twitter Avatar Reloaded WordPress Plugin复制了这段代码

    【讨论】:

    • 这会保存用户输入的详细信息吗?另外,是否可以添加下拉菜单...或任何其他类型的输入?
    • 是的,它会将用户输入的数据保存在用户的自定义字段中
    • 是否可以添加任何其他类型的输入,例如下拉菜单?
    • 是的,这是可能的。查看codesleepshred.com/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-12-27
    • 2019-11-23
    • 2013-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-09
    相关资源
    最近更新 更多