Browse Source

update to mmo

master
Felty 2 years ago
parent
commit
b32928dfc6
4 changed files with 44 additions and 41 deletions
  1. +36
    -36
      vidyen-wc-mmo/includes/shortcodes/vidyen-mmo-loa-id.php
  2. +5
    -3
      vidyen-wc-mmo/includes/shortcodes/vidyen-mmo-register.php
  3. +1
    -1
      vidyen-wc-mmo/vidyen-wc-mmo-template-function.php
  4. +2
    -1
      vidyen-wc-mmo/vidyen-wc-mmo.php

+ 36
- 36
vidyen-wc-mmo/includes/shortcodes/vidyen-mmo-loa-id.php View File

@ -120,47 +120,47 @@ function vidyen_mmo_loa_id_func($atts)
//Ok now we update in hell! (Hell = usermeta table) I wonder if anyone reads these coments. 300 was a good movie. -Felty
update_user_meta( $user_id, $key, $loa_id );
}
//Adding a nonce to the post
$vyps_nonce_check = wp_create_nonce( 'vyps-nonce' );
//Adding a nonce to the post
$vyps_nonce_check = wp_create_nonce( 'vyps-nonce' );
//displaying loa_id if EXISTS
if (strlen($loa_id) > 1)
{
$display_loa_id = $loa_id; //I'm really guessing here as just assuming that if they put in more than one. Probaly should do validation somewhere down road
}
else
{
$display_loa_id = "No LoA ID set!"; //Just some text
}
$loa_id = get_user_meta( $user_id, $key, $single ); //I forgot this. Shoudl work now.
$form_result_ouput = "
<div>
<form method=\"post\" name=\"createuser\" id=\"createuser\" class=\"validate\" novalidate=\"novalidate\" enctype=\"multipart/form-data\">
<table class=\"form-table\">
<tbody>
<tr class=\"form-field form-required\">
<th scope=\"row\">
<label for=\"loa_id\">LoA ID:</label>
</th>
<td>
<input name=\"loa_id\" type=\"text\" id=\"loa_id\" value=\"$display_loa_id\" autocapitalize=\"none\" autocorrect=\"off\" maxlength=\"256\" disabled>
</td>
</tr>
</tbody>
</table>
<p class=\"submit\">
<input type=\"hidden\" name=\"vypsnoncepost\" id=\"vypsnoncepost\" value=\"$vyps_nonce_check\" />
<input type=\"hidden\" name=\"clear_loa_id_action\" id=\"clear_loa_id_action\" value=\"clear_loa_id_action\" />
<input type=\"submit\" name=\"clear_loa_id\" id=\"clear_loa_id\" class=\"button button-primary\" value=\"Clear ID\" onclick=\"return confirm('Are you sure you want to clear your ID? It will have to be re-registered from game client again.');\">
</p>
</form>
</div>
";
//displaying loa_id if EXISTS
if (strlen($loa_id) > 1)
{
$display_loa_id = $loa_id; //I'm really guessing here as just assuming that if they put in more than one. Probaly should do validation somewhere down road
}
else
{
$display_loa_id = "No LoA ID set!"; //Just some text
}
}
$form_result_ouput =
"<div>
<form method=\"post\" name=\"createuser\" id=\"createuser\" class=\"validate\" novalidate=\"novalidate\" enctype=\"multipart/form-data\">
<table class=\"form-table\">
<tbody>
<tr class=\"form-field form-required\">
<th scope=\"row\">
<label for=\"loa_id\">LoA ID:</label>
</th>
<td>
<input name=\"loa_id\" type=\"text\" id=\"loa_id\" value=\"$display_loa_id\" autocapitalize=\"none\" autocorrect=\"off\" maxlength=\"256\" disabled>
</td>
</tr>
</tbody>
</table>
<p class=\"submit\">
<input type=\"hidden\" name=\"vypsnoncepost\" id=\"vypsnoncepost\" value=\"$vyps_nonce_check\" />
<input type=\"hidden\" name=\"clear_loa_id_action\" id=\"clear_loa_id_action\" value=\"clear_loa_id_action\" />
<input type=\"submit\" name=\"clear_loa_id\" id=\"clear_loa_id\" class=\"button button-primary\" value=\"Clear ID\" onclick=\"return confirm('Are you sure you want to clear your ID? It will have to be re-registered from game client again.');\">
</p>
</form>
</div>
";
}
//Remember kids. Always return shortcodes. Never echo or you are going to have a bad time.
return $form_result_ouput;

+ 5
- 3
vidyen-wc-mmo/includes/shortcodes/vidyen-mmo-register.php View File

@ -79,9 +79,9 @@ function vidyen_mmo_postback_register_func( $atts )
//Ok now we know the user is on site.
$loa_user_id = sanitize_text_field($_POST['userid']);
$user_id = vidyen_mmo_loa_user_query_func($loa_user_id);
$loa_id_check = intval(vidyen_mmo_loa_user_query_func($loa_user_id));
//$user_id = 1; //Hard coded for now
if ($user_id > 1)
if ($loa_id_check > 1)
{
return 0; //Id was already found
}
@ -90,7 +90,9 @@ function vidyen_mmo_postback_register_func( $atts )
$key = 'vidyen_mmo_loa_id';
//Ok now we just register it.
update_user_meta( $user_id, $key, $loa_id );
update_user_meta( $user_id, $key, $loa_user_id );
return 1; //sucess.
}

+ 1
- 1
vidyen-wc-mmo/vidyen-wc-mmo-template-function.php View File

@ -51,7 +51,7 @@ class vidyenMMOPageTemplater {
);
// Add your templates to this array.
$this->templates = array(
'vidyen-wc-mmo-template.php' => 'vidyen MMO Template',
'vidyen-wc-mmo-template.php' => 'VidYen MMO Template',
);
}
/**

+ 2
- 1
vidyen-wc-mmo/vidyen-wc-mmo.php View File

@ -3,7 +3,7 @@
Plugin Name: VidYen MMO Plugin
Plugin URI: https://wordpress.org/plugins/vidyen-point-system-vyps/
Description: MMO Support Plugin
Version: 0.1.9
Version: 0.2.0
Author: VidYen, LLC
Author URI: https://vidyen.com/
License: GPLv2
@ -84,6 +84,7 @@ include( plugin_dir_path( __FILE__ ) . 'includes/shortcodes/vyps-wc-mmo-point-ex
include( plugin_dir_path( __FILE__ ) . 'includes/shortcodes/vidyen-mmo-postback.php'); //Post back for game transfers
include( plugin_dir_path( __FILE__ ) . 'includes/shortcodes/vidyen-mmo-api-bal.php'); //Post back for game transfers
include( plugin_dir_path( __FILE__ ) . 'includes/shortcodes/vidyen-mmo-loa-id.php'); //Stores the LOA Player ID
include( plugin_dir_path( __FILE__ ) . 'includes/shortcodes/vidyen-mmo-register.php'); //Registers the User ID
/*** Menu Includes ***/
include( plugin_dir_path( __FILE__ ) . 'vidyen-wc-mmo-menu.php'); //Order 600

Loading…
Cancel
Save