PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

User avatar added to MU plugins

s2Member Plugin. A Membership plugin for WordPress®.

User avatar added to MU plugins

Postby dskallman » July 18th, 2011, 12:25 pm

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
Last edited by Cristián Lávaque on July 19th, 2011, 10:03 pm, edited 1 time in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
dskallman
Registered User
Registered User
 
Posts: 68
Joined: October 18, 2010

Re: User avatar added to MU plugins

Postby Cristián Lávaque » July 21st, 2011, 3:58 pm

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. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron