Set paypal email address on the front end without having users to use the backend.

I've managed to create a front-end experience for my users that want to create their own stores with default settings using New Blog Template. The last thing I need is for there to be a way to save their paypal email address, paypal currency, and paypal Mode via the Extra Fields on their profile.

I already have the fields:

Paypal Address
Paypal Currency

on the Edit Profile form via CIMY Extra User Fields.

All I need now is that when the form is submitted, the Paypal fields (set paypal chain payments, remove sandbox/make live, currency) don'tt only get saved in the CIMY Extra User Fields database BUT also in the mp_options string.

How can I do this.

Thank you,
Giovanni

PS - I know this is a customization and I should put it on the job postings BUT I have had very bad luck with posting on the job site, so I'm doing it myself. I hope someone can help with this.

-----------------------------
I tried adding a reply to this but for some reason I couldn't. I was able to figure it out:

add_action( 'personal_options_update', 'save_paypalfield' );
add_action( 'edit_user_profile_update', 'save_paypalfield );

function save_paypalfield( $user_id ) {

	if ( !current_user_can( 'edit_user', $user_id ) )
		return false;

	/* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
	$mp_settings = get_option('mp_settings');

	$mp_settings['gateways']['paypal-chained']['email'] = $_POST['PAYPALEMAIL'];
	$mp_settings['gateways']['paypal-chained']['currency'] = 'USD';
	$mp_settings['gateways']['paypal-chained']['mode'] = 'live';
	update_option('mp_settings', $mp_settings);

}

You can send a POST for currency and mode as well.

Hopefully this can help someone.

  • aecnu

    Greetings Giovanni,

    Thank you for being a WPMU Dev member!

    If I understand correctly you have managed to get this sorted out on your own and thank you for sharing the coding for all WPMU Dev members to possibly use in there projects.

    Some rep points have been sent your way for code submission!

    If it wasn't resolved, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Cheers, Joe :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.