<?php

global $czpf_plugin;

function send_error_die( $msg ) {
	die( json_encode( array(
		'R'   => 'ERR',
		'MSG' => $msg
	) ) );
}

if ( ! is_user_logged_in() ) {
	send_error_die( __( 'You are not logged in.', 'rhc' ) );
}

$current_user = wp_get_current_user();

update_user_meta( $current_user->ID, $_REQUEST['save_social'] . '_czpf', $_REQUEST['url'] );
update_user_meta( $current_user->ID, $_REQUEST['save_social'] . '_id_czpf', $_REQUEST['id'] );
update_user_meta( $current_user->ID, $_REQUEST['save_social'] . '_email_czpf', $_REQUEST['email'] );
update_user_meta( $current_user->ID, 'editdate', date( 'Y-m-d H:i:s' ) );

die( json_encode( array( 'R' => 'OK' ) ) );
