Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Profile information

  • Hi. I want to change the data that is collected in the Registration:Profile Information page of bbpress. Some background…

    I have a bbpress/WPMU integration. The system is working fine in terms of the two sites being integrated. When a user goes to register for an account on the forum, they are presented with a form with name, email, website, occupation, location and interests. I see in the source code where the associative array is (get_profile_info_keys). So I could modify the fields there, but there must be some “proper” way to change the profile info that is gathered.

    I apologize if this is plainly explained somewhere. I can’t seem to find any admin page related to changing the bbpress profile info. I’d prefer to do this the sanctioned way and not modify source files.

    Reading other posts I see stuff about plugins and the profile, but surely that isn’t the easiest way to change the nature of the data collected?

Viewing 8 replies - 1 through 8 (of 8 total)
  • I should add that my objective is to change the info collected to be related to the nature of the website. Occupation, Location, and such is not the right data for the website in question.

    I also note that these are text fields ONLY. The content creator of this particular website wanted a dropdown question. I talked her out of it, but how would you do something like that?

    Lastly, WHERE is it documented how the profile system works if anywhere. I found the source code was all I could find.


    chrishajer
    Participant

    @chrishajer

    I think a plugin IS the easiest way to do it without having to resort to modifying core files, which is generally a bad idea. You lose your changes when you upgrade bbPress.

    I think you’ve found the best information about the profile already by browsing the source. There is no official documentation that I know of, but browsing the source is good, and there is at a start of an additional source:

    http://bbpulp.org/wiki/Main_Page

    I wish I knew more about plugins to help you with this, but I don’t. I’m sure someone else will come along and explain how to do this easily. There is another current thread about modifying the profile information, so learning how to do it would help in both places. I’m pretty sure the answer is to do it with a plugin rather than modifying core files.

    We’re writing our own history here :-b)

    Thanks. I will investigate the plugin concept today. Indeed we are writing our own history here!

    Maybe I’m being thick today, but I don’t really see how a plugin solves my problem after looking at them. Indeed there is an apply_filter call to read the user profile info, but the names of the keys in the associative arrive are assumed in various places around the code. As far as I can tell there wasn’t any forethought into an admin wanting to replace the user info collected at registration with something relevant to the specific forums domain.

    I think either I am missing some aspect of the plugins or this an area that could be improved upon for customization by the admin.

    Am I missing something that anyone can see? The problem appears to be akismet.php where the key of the user profile info is hardcoded into the code. In my version of the file line 86 and 148 seem to assume the keys to info have not been modified.

    Here’s where I’m at. if I modify the function get_profile_info_keys in /wpmu/bbpress/bb-includes/functions.php and change the definition of get_profile_info_keys to what I want, it’s all good. I changed the text to make it fit and apologize for poor formatting. The downside here is I am changing bbpress code, not my own template. There was no documentation indicating get_profile_info_keys is eligible for being plugged in, but it seems like it is. So I tried hardcoding first to see if this obtained the desired results. It did. The profile info prompts displayed correctly on registration page, the data was written the appropriate usermeta table, and viewing the profile displays the newly named fields and shows correct data. So far so good. Below is the code (sorry for poor formatting). Of course, the fatal flaw here is this NEEDS to be done in a plugin. So now I will tackle this. If anyone has a plugin sample for bbpress that shows modification of profile_info_keys I would be very grateful to take a peek. I believe by tomorrow I will have this hashed out and working properly as a plugin with no changes to core bbpress code. I will share that code here when I get there. In the meantime, feel free to flame, compliment, empower, disempower, or any other useful feedback! I am heading into no man’s land…

    //meta_key => (required?, Label). Don’t use user_{anything} as the name of your meta_key.

    function get_profile_info_keys() {

    return apply_filters(

    ‘get_profile_info_keys’,

    array(

    ‘user_email’ => array(1, __(‘Email’)),

    ‘tip’ => array(0, __(‘A tip you would like to share?’)), ‘favorite’ => array(0, __(‘Favorite products?’)),

    ‘more’ => array(0, __(‘How are you getting more?’)),

    ‘interest’ => array(0, __(‘Hobbies/interests?’))) );

    /* original array follows

    array(

    ‘user_email’ => array(1, __(‘Email’)),

    ‘user_url’ => array(0, __(‘Website’)),

    ‘from’ => array(0, __(‘Location’)),

    ‘occ’ => array(0, __(‘Occupation’)), ‘

    interest’ => array(0, __(‘Interests’))) );

    */

    What I’d love is to see someone has tread in these waters and knows how to use a plugin to implement an overridden get_profile_info_keys. I’m getting old for these all night programming marathons. It was fun the first three decades, but now the arthritis flares up and I have to break to take my Centrum Silver… So all help will result in admiration from me to you! Ships ahoy.

    Aha, this post looks like my golden ticket to see Willy Wonka’s chocolate factory up close and personal. Holy cow, I’d getting giddy…

    http://www.livibetter.com/it/topic/add-new-user-profile-fields

    Maybe I’ll will put this issue to rest TONIGHT!

    Dang. Your chocolate factory is a dead link.

    Did you ever figure this out? I’d like to change the profile information too. It seems like the avatar plug-in does something similar.


    xanderashwell
    Member

    @xanderashwell

    If anyone is still looking for the solution to this, there is a suitable fix (creating a plugin to do the heavy lifting)

    here

    Basically, create a new plugin by saving the following code as “my-plugin.php” or whatever you might like to call it, in the my-plugins folder:

    <?php

    /*

    Plugin Name: Profile Details

    Plugin URI: https://bbpress.org/

    Description: This plugin adjusts the information required at registration, and which information is displayed on the profile page.

    Author: A.Example

    Version: 0.333

    Author URI: https://bbpress.org/

    */

    function set_my_profile_info_keys($myarray) {

    $myarray = array(

    //’first_name’ => array(0, __(‘First name’)),

    //’last_name’ => array(0, __(‘Last name’)),

    ‘display_name’ => array(1, __(‘Display name as’)),

    ‘user_email’ => array(1, __(‘Email’)),

    //’user_url’ => array(0, __(‘Website’)),

    //’from’ => array(0, __(‘Location’)),

    //’occ’ => array(0, __(‘Occupation’)),

    //’interest’ => array(0, __(‘Interests’))

    );

    return $myarray;

    }

    add_filter(‘get_profile_info_keys’, ‘set_my_profile_info_keys’);

    ?>

    I hope that helps someone out, full credit must go to Olaf for this fix.

    Namasté,

    Xander

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar