Info
- 9 posts
- 6 voices
- Started 4 years ago by citizenkeith
- Latest reply from _ck_
- This topic is resolved
User-editable Custom Titles
-
- Posted 4 years ago #
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?
-
- Posted 4 years ago #
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_keysan 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. -
- Posted 4 years ago #
Well, I don't know the first thing about writing plugins, so if somebody can help out, I'd appreciate it. :)
-
- Posted 4 years ago #
in functions.php find
function get_profile_admin_keys() {, and move$bb_table_prefix . 'title' => array(0, __('User Title'))from that function's array tofunction get_profile_info_keys() -
- Posted 4 years ago #
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'))) ); } -
- Posted 4 years ago #
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.
-
- Posted 4 years ago #
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...
-
- Posted 3 years ago #
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!
-
- Posted 3 years ago #
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; } -
You must log in to post.