Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Customizing Profile Fields


John Blackbourn
Participant

@johnbillion

@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.

Skip to toolbar