Home › Forums › Calendar Products › Events Calendar PRO › check organizer name
- This topic has 10 replies, 2 voices, and was last updated 9 years ago by Brian.
-
AuthorPosts
-
March 6, 2015 at 9:19 am #946530Chris ChungParticipant
Hey
I am trying to figure this out, I want to check the organizer of a event.
Then on my Gravity Form send a notification to that organizer.
Pseudo code of how it should probably look like.//add filter for tribe organizer(….)
//add filter for gravity forms(….)//function tribe organizer(….) {
//function gravity form notification(….) {
//$variable = …..;
//if tribe organizer == ‘xyz’;
//send to e-mail = ‘[email protected]’;
}
//return something either here;
}Thanks
March 6, 2015 at 12:08 pm #946588BrianKeymasterHi,
Thanks for using our plugins.
I can try to help your out here for the most part customizations are beyond the support we can provide.
Here is some information about the Organizer Custom Post Type and Custom Fields to help get your started:
Organizer Custom Post Type ( tribe_organizer )
_OrganizerOrganizer
_OrganizerEmail
_OrganizerWebsite
_OrganizerPhoneTo get Organizer ID for an event use this function:
tribe_get_organizer_id( $event_id );
Using that information you could check for an Organizer name is this custom field: _OrganizerOrganizer
Let me know if you have any follow up questions.
Thanks
March 11, 2015 at 8:16 am #947580Chris ChungParticipantThanks for the response! I don’t think I have fully understood how the functions and hooks work yet.
As a test I tried to get the organizers name and then use it in another function, for example:
//Here I attempt to grab the organizer function tribe_get_organizer1( $postId = 23864 ) { $postId = TribeEvents::postIdHelper( $postId ); $organizer_id = (int) tribe_get_organizer_id( $postId ); $output = ''; if ( $organizer_id > 0 ) { $output = esc_html( get_the_title( $organizer_id ) ); return apply_filters( 'tribe_get_organizer1', $output ); } return $output; }
Did I use the function correctly? Trying to reference $output in another function like echo $output or something like It seems like it should be made as a global variable.
Thanks again,
Chris
March 11, 2015 at 9:27 am #947636BrianKeymasterI would try something like this and just pass the eventid ($postId) to it:
function tribe_get_organizer1( $postId ) {
$organizer_id = tribe_get_organizer_id( $postId );
$output = '';
if ( $organizer_id ) {
$output = esc_html( get_the_title( $organizer_id ) );
}
return $output;
}Then you could call it like this:
echo tribe_get_organizer1( $variablewithID );
March 12, 2015 at 11:43 am #947954Chris ChungParticipantThanks again Brian!
Would it work to use this in conjunction with tribe_is_event function to check if an event has a certain organizer, I know you mentioned “_OrganizerOrganizer” earlier
if ( tribe_is_event == true && tribe_get_organizer(123456) == true) do the following
Thanks!
Chris
March 12, 2015 at 11:57 am #947959BrianKeymasterI am not sure if that would work. I am not able to troubleshoot custom coding for the most part.
I do not think the ‘== true’ is needed for either of those statements as I do not think it would return true.
You are going to have to play around with it some more to get it working how you would like.
April 3, 2015 at 12:50 pm #953130Chris ChungParticipantOk so now I got somewhere, part of it is from other plug-ins I use “gravity forms” “event registration”,
the switch case doesn’t seem to be working as now both organizers/users are receiving the notification.
Banging my head to figure out why 😛function tribe_event_test($notification, $form, $entry)
{
$args_e = array(
‘post_type’ => ‘tribe_events’
);
$post_query_e = new WP_Query($args_e);if($post_query_e->have_posts() ) {
while($post_query_e->have_posts() ) {
$i = sp_get_organizer();
switch ($i) {
case “Joe”:
if ( $notification[‘name’] == ‘Joe’ ) {
$notification[‘toType’] = ’email’;
$notification[‘to’] = ‘[email protected]’;
}
break;
case “Tom”:
if ( $notification[‘name’] == ‘Tom’ ) {
$notification[‘toType’] = ’email’;
$notification[‘to’] = ‘[email protected]’;
}
break;
}
}
return $notification;
}
add_filter( ‘gform_notification_1’, ‘tribe_event_test’, 10, 3 );April 3, 2015 at 1:24 pm #953153BrianKeymasterI am not sure what is causing this. I would like to help out, but per our terms of service it is beyond the support we can provide to troubleshoot custom coding.
Sorry I cannot help.
April 13, 2015 at 8:42 am #955075Chris ChungParticipantI see the notifications are being sent on an event with no organizer, I am looking over my if and case statements to try and figure out why. Check who is the organizer of the event ie check the organizer field in the post_type tribe_events.
April 13, 2015 at 12:33 pm #955170BrianKeymasterThe Organizer is a different post type then the events.
Here is a complete list:
https://gist.github.com/jesseeproductions/c2df90a56827dae990a0
April 30, 2015 at 4:59 am #959530BrianKeymasterSince there is has not been any activity on this thread for over 2 weeks so I am now closing it. Feel free to start a new thread if you have further issues. Thanks! 🙂
-
AuthorPosts
- The topic ‘check organizer name’ is closed to new replies.