_registry->get( 'acl.aco' );
if ( true === $aco->are_we_editing_our_post() ) {
?>
post_type == "ai1ec_event" ) {
$actions['clone'] = '' . __( 'Clone', AI1EC_PLUGIN_NAME ) . '';
$actions['edit_as_new_draft'] = '' . __( 'Clone to Draft', AI1EC_PLUGIN_NAME ) . '';
}
return $actions;
}
/**
* Retrieve duplicate post link for post.
*
*
* @param int $id Optional. Post ID.
* @param string $context Optional, default to display. How to write the '&', defaults to '&'.
* @param string $draft Optional, default to true
* @return string
*/
function ai1ec_duplicate_post_get_clone_post_link( $id = 0, $context = 'display', $draft = true ) {
if ( ! $post = get_post( $id ) ) {
return;
}
if ( $draft ) {
$action_name = "ai1ec_duplicate_post_save_as_new_post_draft";
} else {
$action_name = "ai1ec_duplicate_post_save_as_new_post";
}
if ( 'display' == $context ) {
$action = '?action=' . $action_name . '&post=' . $post->ID;
} else {
$action = '?action=' . $action_name . '&post=' . $post->ID;
}
$post_type_object = get_post_type_object( $post->post_type );
if ( ! $post_type_object ) {
return;
}
return apply_filters(
'ai1ec_duplicate_post_get_clone_post_link',
wp_nonce_url(
ai1ec_admin_url( 'admin.php' . $action ),
'ai1ec_clone_' . $post->ID
),
$post->ID,
$context
);
}
}