Plugin Directory

Changeset 1249089


Ignore:
Timestamp:
09/19/2015 08:15:13 AM (11 years ago)
Author:
Moisture
Message:

Add hooks for managing extra fields

'am_save_event' and 'am_copy_event'

Location:
am-events/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • am-events/trunk/am-events.php

    r1237993 r1249089  
    44  Plugin URI: http://wordpress.org/extend/plugins/am-events/
    55  Description: Adds a post type for events and a customizable widget for displaying upcoming events.
    6   Version: 1.9.8
     6  Version: 1.10.0
    77  Author: Atte Moisio
    88  Author URI: http://attemoisio.fi
     
    521521     */
    522522    if ($_POST && get_post_type($post) === 'am_event') {
    523 
     523   
    524524        // Has the field been used?
    525525        $temp1 = trim($_POST['am_startdate']);
     
    547547        else
    548548            return;
     549           
     550        do_action( 'am_save_event', $event_post_id );
    549551
    550552    }
     
    10521054    $_POST += array("am_quickedit_nonce" => '');
    10531055    if ( wp_verify_nonce( $_POST["am_quickedit_nonce"], plugin_basename( __FILE__ ) ) ) {
    1054         // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want
    1055         // to do anything
     1056   
     1057        // verify if this is an auto save routine. If it is, our form has not been submitted, so we don't want to do anything
    10561058        if ( $_POST['post_type'] !== 'am_event' ) {
    10571059            return;
     
    10611063        }
    10621064
    1063         if ( isset( $_REQUEST['am_startdate'] ) ) {
    1064             $startdate = strtotime($_REQUEST['am_startdate'] );
    1065             if ($startdate)
    1066                 update_post_meta( $post_id, 'am_startdate', date( am_get_default_date_format(), $startdate) );
    1067         }
    1068         if ( isset( $_REQUEST['am_enddate'] ) ) {
    1069             $enddate = strtotime($_REQUEST['am_enddate'] );
    1070             if ($enddate)
    1071                 update_post_meta( $post_id, 'am_enddate', date( am_get_default_date_format(), $enddate));
    1072         }
     1065        am_update_post_meta_date($post_id, 'am_startdate');
     1066        am_update_post_meta_date($post_id, 'am_enddate');
     1067   
    10731068    }
    10741069    // Normal edit
     
    11471142                        am_copy_replace_terms($post_id, $new_post_id, 'am_event_categories');
    11481143                        am_copy_replace_terms($post_id, $new_post_id, 'am_venues');
     1144                       
     1145                        do_action( 'am_copy_event', $post_id, $new_post_id );
    11491146
    11501147                    }
     
    12001197                        wp_update_post( $recurrent_post );
    12011198                        add_action('save_post', 'am_save_custom_meta');
    1202 
     1199                       
    12031200                        am_copy_replace_tags($post_id, $id);
    12041201                        set_post_thumbnail($id, get_post_thumbnail_id($post_id));
     
    12071204                        am_copy_replace_terms($post_id, $id, 'am_venues');
    12081205
     1206                        do_action( 'am_copy_event', $post_id, $id );
     1207                       
    12091208                    }
    12101209
     
    12181217    }
    12191218
    1220 
     1219}
     1220
     1221function am_update_post_meta_date($post_id, $meta_key) {
     1222    if ( isset( $_REQUEST[$meta_key] ) ) {
     1223        $enddate = strtotime($_REQUEST[$meta_key] );
     1224        if ($enddate)
     1225            update_post_meta( $post_id, $meta_key, date( am_get_default_date_format(), $enddate));
     1226    }
    12211227}
    12221228
  • am-events/trunk/readme.txt

    r1237993 r1249089  
    44Requires at least: 3.3.1
    55Tested up to: 4.3
    6 Stable tag: 1.9.8
     6Stable tag: 1.10.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5555
    5656== Changelog ==
     57
     58= 1.10.0 =
     59* Added hooks for including extra fields to event posts
    5760
    5861= 1.9.8 =
     
    137140
    138141== Upgrade Notice ==
     142
     143= 1.10.0 =
     144* Adds hooks for including extra fields to event posts
    139145
    140146= 1.9.8 =
Note: See TracChangeset for help on using the changeset viewer.