Plugin Directory

Changeset 770568


Ignore:
Timestamp:
09/12/2013 12:09:56 AM (12 years ago)
Author:
wycks
Message:

Fixed 2 bugs with note query and meta query

Location:
simple-admin-notes/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • simple-admin-notes/trunk/readme.txt

    r767213 r770568  
    44Tags: notes, admin notes, notepad, client notes, notes, help
    55Requires at least: 3.5
    6 Tested up to: 3.6
    7 Stable tag: 1.2.0
     6Tested up to: 3.6.1
     7Stable tag: 1.3.0
    88
    99Adds a simple "Notes" section to the admin menu or posts
  • simple-admin-notes/trunk/simple-notes.php

    r767213 r770568  
    66Author: Wycks
    77Author URI: http://wordpress.org/extend/plugins/profile/wycks
    8 Version: 1.2.0
     8Version: 1.3.0
    99License: GPL2
    1010*/
     
    186186        * @param string $screens visible in defualt notes section
    187187        * @param string $notesposts query
     188        * @param string $get_ids post id string stored in meta field
     189        * @param array $id_pieces array of post id's
    188190        */
    189191        function wpt_box_san($post_id){
     
    204206                    'no_found_rows'   => true,
    205207                    'meta_query'     => array(
    206                             array( 
    207                                 'value'   => $post_id,
    208                                 'compare' => 'LIKE',
     208                            array(
     209                                'key'     => 'note_ids',
     210                                'value'   => array(''),
     211                                'compare' => 'NOT IN'
    209212                                ),
    210213                            )
     
    215218                    foreach(  $notesposts as $notespost ) : setup_postdata( $notespost );
    216219
    217                         $placement_above = get_post_meta( $notespost->ID, 'note_placement_above', true );
    218                         $placement_below = get_post_meta( $notespost->ID, 'note_placement_below', true );       
    219      
    220                         $title = $notespost->post_title;
    221 
    222                         $output = get_the_content();
    223                         $output = apply_filters( 'the_content', $output );
    224                         $output = str_replace( ']]>', ']]>', $output );
     220                        $get_ids = get_post_meta( $notespost->ID, 'note_ids', true );
     221                        $id_pieces = explode(",", $get_ids);
     222
     223                        if (in_array($post_id, $id_pieces)) {
     224
     225                            $placement_above = get_post_meta( $notespost->ID, 'note_placement_above', true );
     226                            $placement_below = get_post_meta( $notespost->ID, 'note_placement_below', true ); 
     227         
     228                            $title = $notespost->post_title;
     229
     230                            $output = get_the_content();
     231                            $output = apply_filters( 'the_content', $output );
     232                            $output = str_replace( ']]>', ']]>', $output );
     233                        }
    225234
    226235                    endforeach;
     
    287296        function my_notes_options_san(){
    288297
    289             if ( is_admin() ) { ?>
     298            $screen = get_current_screen();
     299            if ( is_admin() && ($screen->id = 'note_page_my_notes')) { ?>
    290300
    291301            <script type="text/javascript">
     
    311321                    'meta_query' => array(
    312322                            array(
     323                                'posts_per_page'  => -1,
     324                                'no_found_rows'   => true,
    313325                                'key' => 'note_placement_yes',
    314326                                'value' => '',
     
    417429        })
    418430       
    419         jQuery('#san-below').click(function(){
     431        jQuery('#san-below').click(function(){
    420432            if (this.checked) {
    421433                jQuery('#san-above').prop('checked', false);
Note: See TracChangeset for help on using the changeset viewer.