Forums

Join
bbPress Support ForumsInstallationUser-editable Custom Titles

Info

User-editable Custom Titles

  1. I have a small site that needs very little moderation. I'd like for my users to have the power to change their own Custom Title, instead of sending me a Private Message with a request.

    I can't figure out how to make that change, though. Any ideas?

  2. You need to write a plugin that will be called on a hook in the profile, where it adds to the associative array $profile_info_keys an entry with key 'bb_title' - I think. To see how to do that, look at some other plugin that adds fields to the profile info thingy.

  3. Well, I don't know the first thing about writing plugins, so if somebody can help out, I'd appreciate it. :)

  4. in functions.php find function get_profile_admin_keys() {, and move $bb_table_prefix . 'title' => array(0, __('User Title')) from that function's array to function get_profile_info_keys()

  5. Hmm.... not sure to how to change that code without getting errors (I'm running 0.9.0.1 on this particular forum).

    function get_profile_info_keys() {
    	return apply_filters(
    		'get_profile_info_keys',
    		array('user_email' => array(1, __('Email')), 'user_url' => array(0, __('Website')), 'from' => array(0, __('Location')), 'occ' => array(0, __('Occupation')), 'interest' => array(0, __('Interests')))
    	);
    }
    
    function get_profile_admin_keys() {
    	global $bbdb;
    	return apply_filters(
    		'get_profile_admin_keys',
    		array($bbdb->prefix . 'title' => array(0, __('Custom Title')))
    	);
    }
  6. Do just like parabolart said. You should paste the text inside the () after the array for get_profile_admin_keys and separate it from the other ones with a comma.

  7. I think I need a little help with this one. I'm running 0.9.0.2 now.

    Here's the section in functions.php:

    function get_profile_info_keys() {
    	return apply_filters( 'get_profile_info_keys', array(
    		'user_email' => array(1, __('Email')),
    		'user_url' => array(0, __('Website')),
    		'from' => array(0, __('Location')),
    		'occ' => array(0, __('Occupation')),
    		'interest' => array(0, __('Interests')),
    	) );
    }
    
    function get_profile_admin_keys() {
    	global $bbdb;
    	return apply_filters( 'get_profile_admin_keys', array(
    		$bbdb->prefix . 'title' => array(0, __('Custom Title'))
    	) );
    }

    So if I move that section up to get_profile_info_keys, it should look like this, correct?

    function get_profile_info_keys() {
    	global $bbdb;
    	return apply_filters( 'get_profile_info_keys', array(
    		'user_email' => array(1, __('Email')),
    		'user_url' => array(0, __('Website')),
    		'from' => array(0, __('Location')),
    		'occ' => array(0, __('Occupation')),
    		'interest' => array(0, __('Interests')),
    		$bbdb->prefix . 'title' => array(0, __('Custom Title')),
    	) );
    }

    That pretty much removes everything from get_profile_admin_keys, so do I just take that entire section out?

    Thanks for the helping hand...

  8. I know this is an old thread, but I just wanted to say "thanks" to parabolart. I did as you suggested and it worked perfectly!

  9. Never hack the core.
    Especially when that function is right there designed to be filtered.

    see this apply_filters( 'get_profile_info_keys', array(

    It means you can make a simple plugin to modify the info keys on the fly.
    Untested but should work as a plugin:

    /*
    Plugin Name: Allow Title Edit
    */
    add_filter ('get_profile_info_keys', 'allow_title_edit');
    
    function allow_title_edit($array) {
    if (bb_current_user_can('participate')) {
    global $bbdb;
    $array[$bbdb->prefix.'title']= array(0, __('Custom Title'));
    }
    return $array;
    }
  10. You must log in to post.