Plugin Directory

Changeset 1490873


Ignore:
Timestamp:
09/06/2016 10:06:02 AM (10 years ago)
Author:
gtlwpdev
Message:

Bug Fix: In login, device token was not getting updated - Which is solved now.

Location:
all-push-notification
Files:
43 added
2 edited

Legend:

Unmodified
Added
Removed
  • all-push-notification/trunk/all-push-notification-for-wp.php

    r1487061 r1490873  
    44Plugin URI: https://wordpress.org/plugins/all-push-notification/
    55Description: Send push notifications to iOS and Android with custom Editor from wp-admin & When admin publish a new post/page and even new comment is added to any post.
    6 Version: 1.1
     6Version: 1.2
    77Author: GTL Developers (GTL)
    88*/
     
    2525    // And here goes the activation function:
    2626    function all_pushnotification_forwp_install() {
     27       
    2728        global $wpdb;       
    2829        $all_pushnotification_logs = $wpdb->prefix . 'all_pushnotification_logs';
     
    4041       
    4142        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    42         dbDelta( $pushnotification_log_sql );       
     43        dbDelta( $pushnotification_log_sql );   
     44
     45       
    4346        $pushnotification_token_sql = "CREATE TABLE $all_pushnotification_token (
    4447            `push_token_id` int(11) NOT NULL AUTO_INCREMENT,
     
    6063            wp_mkdir_p( $user_dirname );
    6164        }
    62 
     65       
    6366    }   
    6467   
     
    147150        $last_updatedate=current_time( 'mysql' );
    148151        $all_pushnotification_token = $wpdb->prefix . 'all_pushnotification_token';     
    149         $wpdb->replace($all_pushnotification_token,array('push_token_id' => $user_id,'device_token' => $user_device_token,'os_type' => $user_os_type,'user_id' => $user_id,'last_updatedate' => $last_updatedate),array('%d','%s','%s','%d','%s'));         
     152       
     153        $wpdb->replace($all_pushnotification_token,array('push_token_id' => null,'device_token' => $user_device_token,'os_type' => $user_os_type,'user_id' => $user_id,'last_updatedate' => $last_updatedate),array('%d','%s','%s','%d','%s'));         
    150154        //echo $wpdb->last_error;
    151155       
     
    162166        $last_updatedate=current_time( 'mysql' );
    163167        $all_pushnotification_token = $wpdb->prefix . 'all_pushnotification_token';
    164         $wpdb->replace($all_pushnotification_token,array('push_token_id' => $user_id,'device_token' => $user_device_token,'os_type' => $user_os_type,'user_id' => $user_id,'last_updatedate' => $last_updatedate),array('%d','%s','%s','%d','%s'));         
     168       
     169        $wpdb->replace($all_pushnotification_token,array('push_token_id' => null,'device_token' => $user_device_token,'os_type' => $user_os_type,'user_id' => $user_id,'last_updatedate' => $last_updatedate),array('%d','%s','%s','%d','%s'));         
    165170        //echo $wpdb->last_error;       
    166171    }
    167172   
    168173    # user login API action.
    169     function all_PushNotifications_user_login($user_login, $ID) {           
     174    add_action('wp_login', 'all_PushNotifications_user_login', 10, 2);
     175    function all_PushNotifications_user_login($user_login, $user) {         
    170176        global $wpdb;
    171         $user_id;
     177        $datapost=getallheaders(); 
    172178        $user_device_token=$datapost['device_token'];
    173         $user_os_type=$datapost['os_type'];     
    174         $all_pushnotification_token = $wpdb->prefix . 'all_pushnotification_token';
    175         $wpdb->update($all_pushnotification_token,array('device_token' => $user_device_token,'os_type' => $user_os_type,'last_updatedate' => $last_updatedate),array('push_token_id' => $user_id),array('%s','%s','%s'), array( '%d' ));
     179        $user_os_type=$datapost['os_type'];
     180        $last_updatedate=current_time( 'mysql' );
     181        $user_login=$user->user_login;
     182        $user_id=$user->ID;     
     183        $all_pushnotification_token = $wpdb->prefix . 'all_pushnotification_token';
     184       
     185        $wpdb->update($all_pushnotification_token,array('device_token' => $user_device_token,'os_type' => $user_os_type,'last_updatedate' => $last_updatedate),array('user_id' => $user_id),array('%s','%s','%s'), array( '%d' ));
    176186        //echo $wpdb->last_error;
    177187
    178188    }
     189   
    179190   
    180191    # user loginout action.
     
    299310            $request_uri_referrer = $_SERVER['HTTP_REFERER'];
    300311            $request_uri_referrer_parts = explode( 'page=' , $request_uri_referrer );
    301             $current_page_url=$request_uri_referrer_parts[1];
    302        
    303             if ($current_page_url=='all-PushNotifications-WP-settings') {
    304                
    305                 $mydir = '/ioscerti';
    306                 $param['path'] = $param['basedir'] . $mydir;
    307                 $param['url'] = $param['baseurl'] . $mydir;
    308            
    309             }
     312            if(isset($request_uri_referrer_parts[1])) {
     313                $current_page_url=$request_uri_referrer_parts[1];
     314           
     315                if ($current_page_url=='all-PushNotifications-WP-settings') {
     316                   
     317                    $mydir = '/ioscerti';
     318                    $param['path'] = $param['basedir'] . $mydir;
     319                    $param['url'] = $param['baseurl'] . $mydir;
     320               
     321                }   
     322            }
     323           
    310324        }
    311325       
  • all-push-notification/trunk/readme.txt

    r1487061 r1490873  
    55Requires at least: 3.5
    66Tested up to: 4.6
    7 Stable tag: 1.1
     7Stable tag: 1.2
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    6666== Changelog ==
    6767
     68= 1.2 =
     69* Bug Fix: In login, device token was not getting updated - Which is solved now.
     70
    6871= 1.1 =
    6972* Added plugin support for Firebase Cloud Messaging(FCM) , On deactivation All the settings will be removed , On delete the plugin tables and all settigns will drop.
     
    7578
    7679== Upgrade Notice ==
    77 
    78 = 1.1 =
    79 * Added plugin support for Firebase Cloud Messaging(FCM) , On deactivation All the settings will be removed , On delete the plugin tables and all settigns will drop.
    80 
    81 *Updated custom and default message when User send notifiction via Custom message , add/edit post or page
     80Bug Fix: In login, device token was not getting updated - Which is solved now.
    8281
    8382== Translations ==
Note: See TracChangeset for help on using the changeset viewer.