Skip to:
Content
Pages
Categories
Search
Top
Bottom

Customizing Profile Fields


  • ghengisyan
    Member

    @ghengisyan

    Hi, I just started a bbpress forum. I have been messing with the php files (mostly guessing). My question is how do I change the Profile Fields, I don’t want people to put in their Occupation and whatnot, I want them to put their Name and maybe Date of Birth or something, where do I change this?

Viewing 14 replies - 1 through 14 (of 14 total)
  • There is a filter on the function get_profile_info_keys() in bb-includes/functions.bb-core.php which can be used to add and remove profile fields.


    Michael3185
    Member

    @michael3185

    @ghengisyan: “I have been messing with the php files (mostly guessing)” – that’s my methodology too! Seems to be working though, as I’ve managed to do some more than I thought I would, with the help of online PHP tutorials.

    An Extra Profile Fields plugin would be pretty neat. When I was testing Vanilla 1.8, that was one of the things I liked about it. At the bottom of the profile page is an empty ‘name’ field and a matching ‘content’ field. You add what you want, then click a link to add another, etc. It means users can customise the extra information they enter, and I think it feels more personal to them as they get to name the content field. Feeling that it’s more personal is bound to make people stick around I think.

    @johnbillion: I found the filter at line 2201 of functions.php in 0.9.0.5, but have no idea how to use it. If you have a few minutes spare sometime, could you perhaps give us some hints, and a brief snatch of code?

    @Michael3185:

    The user profile fields are simply items in a PHP array. You can remove an item from the array to remove the profile field, or add a new item to the array to add a new profile field.

    <?php

    /*
    Plugin Name: My Profile Fields
    Description: My profile fields for my lovely forums
    Version 1.0
    */

    function my_profile_fields( $fields ) {
    /* This removes the Occupation profile field: */
    unset( $fields['occ'] );
    /* This adds a new optional field called Favourite Band: */
    $fields['faveband'] = array(0,'Favourite Band');
    /* This adds a new *required* field called State: */
    $fields['state'] = array(1,'State');
    /* You must return the array at the end of the function: */
    return $fields;
    }

    add_filter( 'get_profile_info_keys', 'my_profile_fields' );

    ?>

    Save the code above as a .php file and upload it to your my-plugins directory (you may need to create this directory in the root of your forums installation) and then activate it from the Plugins menu in the bbPress admin area.

    Edit: Code updated as a complete example of a plugin.


    Michael3185
    Member

    @michael3185

    @johnbillion: Works like a dream, and I can add and remove whatever I want now. Many thanks.


    Michael3185
    Member

    @michael3185

    @johnbillion: Works like a dream, and I can add and remove whatever I want now. Many thanks.


    Michael3185
    Member

    @michael3185

    Works like a dream, and I can add and remove whatever I want now. Many thanks.


    ghengisyan
    Member

    @ghengisyan

    thats awesome, thanks


    clarklab
    Member

    @clarklab

    That plugin works great but I’ve got an extra request. What would it take to process the data submitted a tiny bit? Like when adding a field for the user’s twitter name. The plugin just automatically inserts whatever they entered onto their profile page. Where would I go to insert the http://twitter.com/ before the username?

    It’s working, but how to hide the fields during the registration? Leaving only the required ones.

    I mean, i just want two fields during the registration, but the user should have the option to edit their profile and add more info, like interest, website etc.

    i tried this plugin, and it removes the extra fields during the registration, which is great, but the problem is, there is no way you can add more info to your profile, since the fields are disabled by this plugin.

    I’m sure it has to do with if and else things but how to code it :(


    dcheung19
    Member

    @dcheung19

    I’ve used this method, but with a little change, instead of creating a variable i’m just returning the array.

    There is no problems when the user is registering, but when I try to edit the fields it’s not saving to the database, any help please

    @ Johnbillion …… Is it possible with this plugin to allow the users to choose a filed from drop down menu,

    like aga, or Marital Status: same as this link

    http://boards.weddingbee.com/register.php

    I hope you’ll understand what I want …

    Thanks,

    Pagal


    Rich Pedley
    Member

    @rich-pedley

    not that i found, but if you do find a solution – let me know!

Viewing 14 replies - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.