• steve098

    (@steve098)


    Hello, I am seeking guidance on how to add a “duplicate event” button to the page that is displayed immediately after publishing a new Event (/wp-admin/post.php?post=xxxx&action=edit)

    I frequently need to create a short series of nearly identical events (same location, same description, categories etc, just changing the date). Currently I do this by adding one event, then going to the Events listing (wp-admin/edit.php?post_type=event) in the admin backend, and clicking “duplicate” a few times next to the event, but this is getting more of a pain as I add more and more events to my site

    It would be fantastic if, after creating and publishing the first event, there was simply a button “duplicate” next to the current “Add event” that is shown as per
    https://snag.gy/PeVUqd.jpg

    I have very basic php knowledge, and would like to think with a gentle point in the right direction (e.g. where to make the code change) I might be able to make the change myself.

    If anyone would be able to give me some pointers I would be most grateful.

    thankyou

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    you can sample code on how to get the duplicate url under file/directory events-manager/templates/tables/events.php

    Thread Starter steve098

    (@steve098)

    Thanks Angelo, this helps

    making progress, some learning for me still to do

    I see the line to form the URL that creates a duplicate event.
    I have found where the ‘add event’ button is created:
    /wp-admin/edit-form-advanced.php line 479
    I can construct a button that appears next to “Add Event” that successfully duplicates the event:

    echo ' <a href="' . esc_url(add_query_arg(array('action'=>'event_duplicate', 'event_id'=>$EM_Event->event_id, '_wpnonce'=> wp_create_nonce('event_duplicate_'.$EM_Event->event_id)))) . '" class="page-title-action">' . 'Duplicate this event' .'</a>';

    now I just need to work out
    1) how to redirect the browser to immediately edit this duplicated event (currently clicking the ‘duplicate’ URL just creates a draft event but remains on the Edit Event page for the original event
    2) how to correctly add the ‘Duplicate Event’ button, as currently it always displays (unlike the existing ‘Add Event’ button that only appears after you have published the Event).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Quick “Duplicate event” button after creating new event?’ is closed to new replies.