Forum Replies Created
-
In reply to: Adding Custom Profile Fields
Alrighty, here’s the scoop:
I added
<?php do_action('extra_profile_info_display', $user); ?>
to myprofile.php
file, right above the second to last line,<?php profile_pages(); ?>
.In my
template-functions.php
file, I have the following:function extra_profile_edit() {
//Globals
global $user_id, $bb_current_user,$bbdb;
// Get dA username, if it exists
$da_username = $bbdb->get_var("SELECT meta_value FROM $bbdb->usermeta WHERE meta_key = 'da_username' AND user_id = '$user_id'");
// Get the user's real name, if it exists
$user_realname = $bbdb->get_var("SELECT meta_value FROM $bbdb->usermeta WHERE meta_key = 'user_realname' AND user_id = '$user_id'");
// Input fields that have a default value of the set variable
echo "
<input
name="da_username"
id="da_username"
type="field"
value="$da_username" />
.deviantart.com
<input name="user_realname"
id="user_realname"
type="field"
value="$user_realname"
/>";
}
And now for the real meat of the thing:
function extra_update() {
global $user_id;
bb_update_usermeta($user_id, "da_username", $_POST['da_username']);
bb_update_usermeta($user_id, "user_realname", $_POST['user_realname']);
}
add_action('extra_profile_info', 'extra_profile_edit');
add_action('profile_edited', 'extra_update');
add_action('extra_profile_info_display', 'extra_display');
My apologies for the length of the post…
In reply to: Adding Custom Profile FieldsI think I’ve found a solution, by searching the forums (go figure).
https://bbpress.org/forums/topic/313?replies=21#post-1672
I quite like this plugin… I’m going to enable it on my forums.
I should have realized… I’m adding an action, not a filter…
[edit] OK, well I’m one step closer, kind of. I need to make a new row (?) for each new profile field.
[another edit]
I’m closer: here’s the function I need;
bb_update_usermeta
In reply to: Adding Custom Profile FieldsHey there, I’m trying something out here… I made a plugin called
template-functions.php
and I’m trying out one thing here.If I put this line:
add_filter(
'get_profile_info_keys',
'extra_profile_info'
);
function extra_profile_info () {}
my profile info is gone, except for the username field and a password field.
I can only see the password field if I view the source… It’s not visible…
Still working on it…
edit: Oh boy, I guess the function extra_profile_info exists! Still going…
another edit:
Well now check this out:
https://trac.bbpress.org/changeset/327
10/13/05… “Hooks for extra fields”?
This is more like it!
In reply to: Adding Custom Profile FieldsAwesome, I’ll give it a go.
Funny you mention your avatar plugin… I saw yours but I wasn’t crazy about the modification of core files, so I wrote my own upload script. It uploads a JPG, GIF, or PNG file under 20kb, with a fixed resolution of 64×64 px. If any of these conditions aren’t met, it spits out an error.
If your username is
UserName
, then the file is namedusername-avatar.gif
or whatever image extension is.I have a simple detection script for the image in the file
post.php
. It works for now, but I’d like something a little better. If you’d like a peek at the code just let me know.I’m working on a PM system, and a post preview “plugin”… it’s slow going though, as college gets in the way quite a considerable bit.
Thanks,
Mike