WP create new organizer in EventsCalendar when user registers with UserManager front-end

Closed Posted Apr 24, 2016 Paid on delivery
Closed Paid on delivery

I have two plugins: Events Calendar and WP User Manager. I have created two roles: Guest and Organizer. I have also created 4 custom fields in WP User Manager:

wpum_event_organizer wpum_organizer_tel wpum_organizer_website wpum_organizer_email

When a new user fills in the front-end registration form (courtesy of WP User Manager) and hits the submit button, I need to achieve the following (bolded):

The user registration gets stored (no problems here)

but a new organizer with the data from the above 4 custom fields is NOT created in Events Calendar

I have tried the code below (inserted in my child theme functions file) and I get no errors (and new user registration happens and gets stored correctly), but no new organizer is created in Events Calendar.

This is the code I am using on my child theme [url removed, login to view] file:

add_action('wpum_before_user_update', 'format_ec_event_meta_from_wpum');

function format_ec_event_meta_from_wpum(){

//Organizer details

$organizerName = event_organizer;

$organizerPhone = organizer_tel;

$organizerWebsite = organizer_website;

$organizerEmail = organizer_email;

$savedOrganizer = get_page_by_title($_POST['wpum_'. $organizerName], 'OBJECT', 'tribe_organizer');

if (isset($savedOrganizer)){

$_POST['organizer']['OrganizerID'] = $savedOrganizer->ID;

} else {

$_POST['organizer']['Organizer'] = $_POST['wpum_'. $organizerName];

$_POST['organizer']['Phone'] = $_POST['wpum_'. $organizerPhone];

if( isset( $_POST['wpum_'. $organizerWebsite] ) )

$_POST['organizer']['Website'] = $_POST['wpum_'. $organizerWebsite] == 'http://' ? '' : $_POST['wpum_'. $organizerWebsite];

if( isset( $_POST['wpum_'. $organizerEmail] ) )

$_POST['organizer']['Email'] = $_POST['wpum_'. $organizerEmail];

}

}

add_action('save_post', 'save_ec_event_meta_from_wpum', 11, 2);

function save_ec_event_meta_from_wpum($postId, $post) {

if( class_exists('TribeEvents') ) {

if ( $post->post_type != TribeEvents::POSTTYPE || defined('DOING_AJAX') ) {

return;

}

if( class_exists('TribeEventsAPI') ) {

$_POST['Organizer'] = stripslashes_deep($_POST['organizer']);

if( !empty($_POST['Organizer']['OrganizerID']) )

$_POST['Organizer'] = array('OrganizerID' => $_POST['Organizer']['OrganizerID']);

TribeEventsAPI::saveEventMeta($postId, $_POST, $post);

}

}

}

Plugin WordPress

Project ID: #10308898

About the project

10 proposals Remote project Active 7 years ago

10 freelancers are bidding on average $31 for this job

shashi99

Hello Warm Greetings! I have gone through your requirement, and it would be immense pleasure to work with your project. I am an out of box thinker and always prefer modern and elegant design to increase the visi More

$55 USD in 3 days
(4 Reviews)
3.4
polupraneeth

Hello Sir, Thank you for taking the time to review my bid! I am having strong hands over Java, PHP, HTML, JSP, CSS, Bootstrap, JavaScript, JQuery, Mysql and other related technologies. I am a Creative Graphics Desi More

$34 USD in 1 day
(5 Reviews)
2.8
cmitexperts

Hi there! Did go through your Job Description and glad to share that I have experience in working with wordpress platform. I have more than four years of industry experience and have been the part of diverse industr More

$20 USD in 1 day
(2 Reviews)
0.4