check organizer name

Home Forums Calendar Products Events Calendar PRO check organizer name

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #946530
    Chris Chung
    Participant

    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

    #946588
    Brian
    Keymaster

    Hi,

    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
    _OrganizerPhone

    To 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

    #947580
    Chris Chung
    Participant

    Thanks 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

    #947636
    Brian
    Keymaster

    I 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 );

    #947954
    Chris Chung
    Participant

    Thanks 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

    #947959
    Brian
    Keymaster

    I 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.

    #953130
    Chris Chung
    Participant

    Ok 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 );

    #953153
    Brian
    Keymaster

    I 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.

    #955075
    Chris Chung
    Participant

    I 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.

    #955170
    Brian
    Keymaster

    The Organizer is a different post type then the events.

    Here is a complete list:

    https://gist.github.com/jesseeproductions/c2df90a56827dae990a0

    #959530
    Brian
    Keymaster

    Since 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! 🙂

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘check organizer name’ is closed to new replies.