Plugin Directory

Changeset 1055221


Ignore:
Timestamp:
12/27/2014 09:26:55 PM (11 years ago)
Author:
TheCertifiedTech
Message:

New Update: Version 1.1 - Retains Data If Xbox Live or API Goes Offline

Location:
mygamertag/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mygamertag/trunk/MyGamerTag.php

    r1053691 r1055221  
    55Plugin URI: http://thecertifiedtech.net
    66Description: Pulls Xbox Gamertag Info And Displays In Widget
    7 Version: 1.0
     7Version: 1.1
    88Author: Paul Dow
    99Author URI: http://thecertifiedtech.net
     
    8484 function widget($args, $instance)
    8585  {
    86   extract( $args, EXTR_SKIP);
     86  extract( $args);
    8787  $title = ($instance['title']);
    8888//
    8989global $wpdb;
    9090$table_name = $wpdb->prefix . 'MyGamerTag';
    91 $userdata = $wpdb->get_row("SELECT * FROM ".$table_name."");
    92 
     91$id = 0;$userdata = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$table_name." WHERE id = %d", $id));
    9392$currentgamertag = $userdata->gamertag;
    9493$currentgamerscore = $userdata->gamerscore;
    95 $currentname = $userdata->name;
    96 $currentlocation = $userdata->location;
    9794$currenttier = $userdata->tier;
    9895$currentrep = $userdata->xboxonerep;
     
    147144    add_menu_page( 'MyGamerTag', 'MGT Settings', 'manage_options', __FILE__, 'MGT_settings' );
    148145}
    149 add_action('settings_refresh','MGT_settings');
    150146function MGT_settings()
    151147{
     
    153149<?php
    154150global $wpdb;
    155 $table_name = $wpdb->prefix . 'MyGamerTag';
    156 $userdata = $wpdb->get_row("SELECT * FROM ".$table_name."");
     151$table_name = $wpdb->prefix . 'MyGamerTag';$id = 0;
     152$userdata = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$table_name." WHERE id = %d", $id));
    157153$currentgamertag = $userdata->gamertag;
    158154$currentxboxapikey = $userdata->xboxapikey;
     
    194190$table_name = $wpdb->prefix . 'MyGamerTag';
    195191$cleangamertag = rawurlencode($_POST['gamertag']);
    196 $wpdb->replace( $table_name, array( 'gamertag' => $cleangamertag, 'xboxapikey' => $_POST['xboxapikey'] ) );
     192$id = 0;
     193$wpdb->update( $table_name, array( 'gamertag' => $cleangamertag, 'xboxapikey' => $_POST['xboxapikey'] ), array('ID' => $id) );
    197194//
    198195do_action('xbox_api','execute_xboxapi');
     
    215212//
    216213$table_name = $wpdb->prefix . 'MyGamerTag';
    217 $userdata = $wpdb->get_row("SELECT * FROM ".$table_name."");
     214$id = 0;$userdata = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$table_name." WHERE id = %d", $id));
    218215$insertgamertag = $userdata->gamertag;
    219216$insertxboxapikey = $userdata->xboxapikey;
     
    227224curl_close($ch);
    228225$pdata = json_decode ( $presult );
    229 $table_name = $wpdb->prefix . 'MyGamerTag';
    230 $wpdb->replace(
     226if ($pdata === NULL){
     227die();
     228}
     229else{
     230$id = 0;
     231$table_name = $wpdb->prefix . 'MyGamerTag';
     232$wpdb->update(
    231233        $table_name,
    232234       array(
     
    234236                'gamerpic'  => $pdata->GameDisplayPicRaw,
    235237                'gamerscore'    => $pdata->Gamerscore,
    236                 'gamertag' => $pdata->Gamertag,
     238                'gamertag' => $userdata->gamertag,
    237239                'xboxonerep' => $pdata->XboxOneRep,
    238240                'xboxapikey' => $userdata->xboxapikey,
    239                 )               
     241                ),                array('ID' => $id)               
    240242            );
    241243//
     
    255257);
    256258}
     259}
    257260register_deactivation_hook(__FILE__,'stop_grabdata');
    258261function stop_grabdata(){  wp_clear_scheduled_hook('xbox_api');}
  • mygamertag/trunk/readme.txt

    r1053700 r1055221  
    55Requires at least: 4.0
    66Tested up to: 4.1
    7 Stable tag: 1.0
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2727
    2828= Option 1 =
     291. Click 'Add New' -> Search WordPress Plugin Directory For 'MyGamerTag'.
     301. Click 'Install Now' Then Click 'Activate'.
     31
     32= Option 2 =
    29331. Unzip 'MyGamerTag.zip' Upload the `MyGamerTag` folder to the `/wp-content/plugins/` directory.
    30341. Activate the plugin through the 'Plugins' menu in WordPress.
    3135
    32 = Option 2 =
     36= Option 3 =
    33371. Click 'Add New' -> 'Upload Plugin' -> 'Choose File' -> Choose The 'MyGamerTag.zip' that you downloaded.
    34 1. Then Activate Plugin
     381. Activate the plugin through the 'Plugins' menu in WordPress.
    3539
    3640You will find 'MGT' settings menu in your WordPress admin panel on the left side.
     
    5761== Changelog ==
    5862
     63= 1.1 =
     64
     65* Plugin Now Retains Data If Xbox Live or API Goes Offline
     66
    5967= 1.0 =
    6068
     
    6371== Upgrade Notice ==
    6472
     73= 1.1 =
     74
     75* Plugin Now Retains Data If Xbox Live or API Goes Offline
     76
    6577= 1.0 =
    6678
Note: See TracChangeset for help on using the changeset viewer.