diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/css/admin.css wordcamp.org/public_html/wp-content/plugins/wc-post-types/css/admin.css
index b5657e8..4909af1 100644
|
|
|
40 | 40 | display: table-caption; |
41 | 41 | font-weight: bold; |
42 | 42 | } |
| 43 | .wcbsponsor-note { |
| 44 | margin-bottom: 1em; |
| 45 | } |
| 46 | .wcbsponsor-note-meta { |
| 47 | font-weight: 800; |
| 48 | } |
| 49 | No newline at end of file |
diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
index 4fd6e51..91671c9 100644
|
|
class WordCamp_Post_Types_Plugin { |
1514 | 1514 | add_meta_box( 'sponsor-info', __( 'Sponsor Info', 'wordcamporg' ), array( $this, 'metabox_sponsor_info' ), 'wcb_sponsor', 'normal' ); |
1515 | 1515 | add_meta_box( 'sponsor-agreement', __( 'Sponsor Agreement', 'wordcamporg' ), array( $this, 'metabox_sponsor_agreement' ), 'wcb_sponsor', 'side' ); |
1516 | 1516 | add_meta_box( 'invoice-sponsor', __( 'Invoice Sponsor', 'wordcamporg' ), array( $this, 'metabox_invoice_sponsor' ), 'wcb_sponsor', 'side' ); |
| 1517 | add_meta_box( 'sponsor-notes', __( 'Sponsor Notes', 'wordcamporg' ), array( $this, 'metabox_sponsor_notes' ), 'wcb_sponsor', 'side' ); |
1517 | 1518 | } |
1518 | 1519 | |
1519 | 1520 | /** |
… |
… |
class WordCamp_Post_Types_Plugin { |
1806 | 1807 | require_once( __DIR__ . '/views/sponsors/metabox-invoice-sponsor.php' ); |
1807 | 1808 | } |
1808 | 1809 | |
| 1810 | function metabox_sponsor_notes( $post ) { |
| 1811 | $existing_notes = get_post_meta( $post->ID, '_wcbsponsor_notes', true ); |
| 1812 | require_once( __DIR__ . '/views/sponsors/metabox-notes.php' ); |
| 1813 | } |
| 1814 | |
1809 | 1815 | /** |
1810 | 1816 | * Fired when a post is saved, makes sure additional metadata is also updated. |
1811 | 1817 | */ |
… |
… |
class WordCamp_Post_Types_Plugin { |
1982 | 1988 | update_post_meta( $post_id, $meta_key, $value ); |
1983 | 1989 | } |
1984 | 1990 | } |
| 1991 | |
| 1992 | $this->validate_and_save_sponsor_notes( $post, $_POST['wcbsponsor_new_note'] ); |
1985 | 1993 | } |
1986 | 1994 | } |
1987 | 1995 | |
1988 | 1996 | /** |
| 1997 | * Validate and save expense data |
| 1998 | * |
| 1999 | * @param WP_Post $post |
| 2000 | * @param array $expenses |
| 2001 | */ |
| 2002 | function validate_and_save_sponsor_notes( $post, $new_note_message ) { |
| 2003 | |
| 2004 | $new_note_message = sanitize_text_field( wp_unslash( $new_note_message ) ); |
| 2005 | |
| 2006 | if ( empty( $new_note_message ) ) { |
| 2007 | return; |
| 2008 | } |
| 2009 | |
| 2010 | $notes = get_post_meta( $post->ID, '_wcbsponsor_notes', true ); |
| 2011 | if ( ! is_array( $notes ) ) { |
| 2012 | $notes = array(); |
| 2013 | } |
| 2014 | |
| 2015 | $new_note = array( |
| 2016 | 'timestamp' => time(), |
| 2017 | 'author_id' => get_current_user_id(), |
| 2018 | 'message' => $new_note_message |
| 2019 | ); |
| 2020 | |
| 2021 | $notes[] = $new_note; |
| 2022 | |
| 2023 | update_post_meta( $post->ID, '_wcbsponsor_notes', $notes ); |
| 2024 | |
| 2025 | } |
| 2026 | |
| 2027 | /** |
1989 | 2028 | * Registers the custom post types, runs during init. |
1990 | 2029 | */ |
1991 | 2030 | function register_post_types() { |