Page 1 of 1

User avatar added to MU plugins

PostPosted: July 18th, 2011, 12:25 pm
by dskallman
Hi,

I added the following code (with the help of Jason Caldwell) into mu-plugins to be able to get data from WP profile default fields.

Code: Select all
<?php
/*
Builds the additional Profile Fields in.
*/
add_filter ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields""my_additional_fields");
function 
my_additional_fields ()
    {
        global 
$current_user;
        
/**/
        
echo '<tr>' "\n";
        echo 
'<td>' "\n";
        echo 
'<label>' "\n";
        echo 
'<strong>Website/URL</strong><br />' "\n";
        echo 
'<input type="text" maxlength="100" name="my_additional_fields[user_url]" style="width:99%;" value="' format_to_edit ($current_user->user_url) . '" />' "\n";
        echo 
'</label>' "\n";
        echo 
'</td>' "\n";
        echo 
'</tr>' "\n";
        
/**/
        
echo '<tr>' "\n";
        echo 
'<td>' "\n";
        echo 
'<label>' "\n";
        echo 
'<strong>Bio/Description</strong><br />' "\n";
        echo 
'<textarea name="my_additional_fields[description]" style="width:99%;">' format_to_edit ($current_user->description) . '</textarea>' "\n";
        echo 
'</label>' "\n";
        echo 
'</td>' "\n";
        echo 
'</tr>' "\n";
        
/**/
        
return true;
    }
/*
Saves the additional Profile Fields.
*/
add_action ("ws_plugin__s2member_during_handle_profile_modifications""save_my_additional_fields");
function 
save_my_additional_fields ($vars = array ())
    {
        
$_post ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
        
/**/
        
$vars["userdata"]["user_url"] = $_post["my_additional_fields"]["user_url"];
        
$vars["userdata"]["description"] = $_post["my_additional_fields"]["description"];
        
/**/
        
wp_update_user ($vars["userdata"]); /* Update. */
    
}
?>


Can I add code here to incorporate the User Avatar (http://wordpress.org/extend/plugins/user-avatar/) plugin that appears in the WP profile? If so, how? What would I add?

Thanks

Re: User avatar added to MU plugins

PostPosted: July 21st, 2011, 3:58 pm
by Cristián Lávaque
I guess you could do it, I just don't know exactly how. I suggest you get a freelance developer from a website like jobs.wordpress.net, oDesk or eLance to help you. :)