Plugin Directory

Changeset 1818276


Ignore:
Timestamp:
02/08/2018 02:45:44 PM (8 years ago)
Author:
tresrl
Message:

HQ60 Fidelity Card - V 1.8

Location:
hq60-fidelity-card/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • hq60-fidelity-card/trunk/hq60fidelitycard.php

    r1817159 r1818276  
    77Author: TRe Technology And Research S.r.l
    88Author URI: http://www.tresrl.it
    9 Version: 1.7
     9Version: 1.8
    1010License: GPL-2.0+
    1111*/
  • hq60-fidelity-card/trunk/readme.txt

    r1817159 r1818276  
    44Requires at least: 4.8.2
    55Tested up to: 4.9.4
    6 Stable tag: 1.7
     6Stable tag: 1.8
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2626
    2727== Changelog ==
     28
     29= 1.8 =
     30* Cancellazione delle registrazioni non confermate dopo 24 ore
    2831
    2932= 1.7 =
  • hq60-fidelity-card/trunk/src/Hq60fidelitycard/Admin/AdminMenu.php

    r1817159 r1818276  
    123123        add_action( 'admin_menu' , array ( $this , 'add_admin_settings_menu' ) );
    124124       
     125        add_filter( 'pre_get_posts' , array ( $this , 'set_custom_post_order' ) );
     126       
    125127     }
     128
     129    /**
     130      * Order the custom post.
     131      * Called from create_admin_settings_menu
     132      *
     133      * @since 1.0
     134      *
     135      */
     136   
     137   
     138    public function set_custom_post_order ($wp_query) {
     139           
     140        if (is_admin()) {
     141               
     142            // Get the post type from the query 
     143            $post_type = $wp_query->query['post_type']; 
     144         
     145            if ( $post_type == $this->get_custom_post_name() ) {
     146         
     147                // 'orderby' value can be any column name 
     148                $wp_query->set('orderby', $this->get_custom_post_name().'-date' ); 
     149         
     150                // 'order' value can be ASC or DESC 
     151                $wp_query->set('order', 'DESC'); 
     152           
     153            }
     154           
     155        }
     156
     157    }
    126158     
    127159     /**
  • hq60-fidelity-card/trunk/src/Hq60fidelitycard/Base.php

    r1807910 r1818276  
    245245        $this->register_custom_post();
    246246       
     247       
     248        //$this->delete_unconfirmed_registration();
     249       
     250        //$cron = new \Hq60fidelitycard\Cron\Cron( $this->get_custom_post_name() );
     251        //$cron->delete_unconfirmed_registration();
     252       
     253       
     254       
     255    }
     256   
     257    /**
     258     * Delete unconfirmed registration
     259     *
     260     * @since 1.7.1
     261     *
     262     */
     263    public function delete_unconfirmed_registration() {
     264       
     265        $post = null;
     266       
     267        $args = array (
     268       
     269       
     270            'posts_per_page'    => -1,
     271            'post_type'         => $this->get_custom_post_name(),
     272           
     273            'date_query' => array(
     274           
     275                'before' => date('Y-m-d H:i:s', strtotime('-1 days'))
     276                 
     277            )
     278           
     279       
     280        );
     281       
     282        /*$first_key = array (
     283       
     284            'key'       =>      $this->get_custom_post_name().'-confirmed-on',
     285            'compare'   =>      'NOT EXISTS'
     286       
     287        );*/
     288       
     289        $first_key = null;
     290               
     291        $meta_query = array (
     292       
     293            $first_key
     294       
     295        );
     296       
     297        $args['meta_query'] = array($meta_query);
     298       
     299        $temp = new \WP_Query( $args );
     300       
     301        if ( $temp->have_posts() ) {
     302           
     303            while ( $temp->have_posts() ) {
     304               
     305                $temp->the_post();
     306               
     307                $id_post = get_the_ID();
     308               
     309                wp_delete_post($id_post);
     310               
     311               
     312            }
     313           
     314        }
     315       
    247316    }
    248317   
     
    701770        // Inizializzazione della funzione
    702771        add_action( 'init', array( $this , 'callback_create_custom_post_type' ) );
     772       
     773        add_action ( 'init' , array ( $this , 'delete_unconfirmed_registration' ) );
    703774       
    704775     }
Note: See TracChangeset for help on using the changeset viewer.