Setting author for anonymously submitted events

Home Forums Calendar Products Community Events Setting author for anonymously submitted events

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1316988
    Natasha
    Participant

    I see this thread on changing the author after the event is submitted. Can we set a default somehow?

    #1317574
    Andras
    Keymaster

    Hello Natasha,

    Thanks for reaching out to us!

    A colleague of mine whipped up the following little snippet for this:


    function ce_set_default_author( $event_id ) {
    remove_action( 'tribe_events_update_meta', 'ce_set_default_author' );
    if ( 0 == get_post_field( 'post_author', $event_id ) ) {
    wp_update_post( array(
    'ID' => $event_id,
    'post_author' => 123
    ) );
    }
    }
    function ce_before_save() {
    add_action( 'tribe_events_update_meta', 'ce_set_default_author' );
    }
    add_action( 'tribe_ce_before_event_submission_page', 'ce_before_save' );

    where ‘123’ is the ID of the default author.

    Please note, this code hasn’t been tested yet.

    Give it a try and let me know if it works.

    Cheers,
    Andras

    #1327905
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Setting author for anonymously submitted events’ is closed to new replies.