Community Support Forums — WordPress® ( Users Helping Users ) — 2011-07-21T15:58:35-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14161 2011-07-21T15:58:35-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14161&p=28856#p28856 <![CDATA[Re: User avatar added to MU plugins]]>

Statistics: Posted by Cristián Lávaque — July 21st, 2011, 3:58 pm


]]>
2011-07-18T12:25:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14161&p=28617#p28617 <![CDATA[User avatar added to MU plugins]]>
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:
<?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

Statistics: Posted by dskallman — July 18th, 2011, 12:25 pm


]]>