Default Author

Home Forums Calendar Products Event Aggregator Default Author

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1082862
    Phil
    Participant

    Hi

    I am using the iCal importer to bring in events I have saved in Google Calendar. I would like them to be automatically published but when I enable this the events are attributed to an author that I don’t want them to be from. The one that is allocated is the first one in my list of the three authors who are working on the site so it might just be that it is picking the first in the list. Please can you let me know how to have a different author allocated to events automatically imported and published.

    Thanks
    Phil

    #1083143
    George
    Participant

    Hey @Phil,

    Thanks for reaching out!

    I took a look through our code to try and find a hook or filter to easily set a default author here, but unfortunately there is no such hook or filter to be found at this time 🙁

    So, unfortunately, there are only two ways to go about setting a default author like you describe. Both unfortunately require custom coding, though in different ways. We unfortunately cannot help with custom coding 🙁

    The first method would be to dive into the plugin code itself and customize the code there. This is not recommended because you would have to re-add this code after each plugin update. Although if you’re interested, you’d want to head into your iCal Importer files and to /src/Tribe/Main.php specifically. On this file there’s a function called processImportSubmission() which is where you can add a post_author specification..

    Another alternative, however, would be to try a simpler customization which is to paste a custom code snippet in your theme’s functions.php like the ones listed here → http://wordpress.stackexchange.com/questions/84782/set-a-user-as-author-of-all-new-posts-posted

    If the user ID of the author you wanted to be default was 332, for example, then you would modify the code in the above-linked example that looks like this:


    $my_post['post_author'] = 1;

    To this:


    $my_post['post_author'] = 332;

    This snippet may not do the job, but is likely to. I hope you try it out and that it helps!

    Sincerely,
    George

    #1088510
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Default Author’ is closed to new replies.