Changeset 659769
- Timestamp:
- 01/27/2013 05:00:34 PM (13 years ago)
- Location:
- cloudwork-verifi/trunk
- Files:
-
- 5 edited
-
cw-verifi.php (modified) (4 diffs)
-
includes/cw-verifi-admin.php (modified) (2 diffs)
-
includes/cw-verifi-functions.php (modified) (5 diffs)
-
includes/cw-verifi-shortcode.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cloudwork-verifi/trunk/cw-verifi.php
r653724 r659769 1 1 <?php 2 // Exit if accessed directly3 if ( !defined( 'ABSPATH' ) ) exit;4 2 /* 5 3 Plugin Name: CloudWork Verifi 6 4 Plugin URI: http://cloudworkthemes.com 7 5 Description: Uses Envato API to verify purchase at registration, prevents duplicate purchase codes 8 Version: 0. 1.26 Version: 0.2 9 7 Author: Chris Kelley <chris@organicbeemedia.com> 10 8 Author URI: http://cloudworkthemes.com … … 27 25 */ 28 26 27 // Exit if accessed directly 28 if ( !defined( 'ABSPATH' ) ) exit; 29 29 30 if ( !class_exists( 'cw_Verifi' ) ) : 30 31 … … 247 248 * 248 249 * @since 0.1 250 * @uses cw_get_purcahse_data 249 251 * @access public 250 252 * @param mixed $user_id … … 253 255 function register_field( $user_id ){ 254 256 255 $meta = isset($_POST['cw_purchase_code']); 256 257 //Add cw_purchase_code to db 258 update_user_meta( $user_id, '_cw_purchase_code' , $meta ); 257 if(isset($_POST['cw_purchase_code'])){ 258 259 $meta = cw_get_purchase_data($_POST['cw_purchase_code']); 260 261 //Add all meta to db 262 update_user_meta( $user_id, '_cw_purchase_code' , $meta ); 263 264 } 259 265 260 266 } -
cloudwork-verifi/trunk/includes/cw-verifi-admin.php
r653724 r659769 1 1 <?php 2 // Exit if accessed directly3 if ( !defined( 'ABSPATH' ) ) exit;4 2 /** 5 3 * @package CloudWork Verifi 6 4 * @subpackage cw-verifi-admin.php 7 * @version 0. 1.25 * @version 0.2 8 6 * @author Chris Kelley <chris@organicbeemedia.com) 9 7 * @copyright Copyright � 2013 CloudWork Themes … … 21 19 * 22 20 */ 21 22 // Exit if accessed directly 23 if ( !defined( 'ABSPATH' ) ) exit; 24 23 25 if ( !class_exists( 'cw_Verifi_admin' ) ) : 24 26 -
cloudwork-verifi/trunk/includes/cw-verifi-functions.php
r653724 r659769 5 5 * @package CloudWork Verifi 6 6 * @subpackage cw-verifi-functions.php 7 * @version 0. 1.27 * @version 0.2 8 8 * @author Chris Kelley <chris@organicbeemedia.com) 9 9 * @copyright Copyright © 2013 CloudWork Themes … … 16 16 * cw_purchase_exists 17 17 * cw_validate_api 18 * cw_get_purchase_data 18 19 * 19 20 */ 20 21 22 // Exit if accessed directly 23 if ( !defined( 'ABSPATH' ) ) exit; 24 21 25 /** 22 26 * Gets user by meta key and meta value 23 * 27 * This function may be depreciated in future version as its not 28 * directly used by the plugin as of 0.2 29 * 24 30 * @thanks Tom Mcfarlin http://tommcfarlin.com 25 31 * @since 0.1 32 * @uses WP_User_Query 26 33 * @access public 27 34 * @param mixed $meta_key … … 52 59 * 53 60 * @since 0.1 54 * @uses cw_get_user_by_meta61 * @uses WP_User_Query 55 62 * @access public 56 63 * @param mixed $cw_purcahse_code … … 59 66 function cw_purchase_exists( $input ) { 60 67 61 if ( $user = cw_get_user_by_meta_data('_cw_purchase_code', $input ) ) { 68 // Query for users based on the meta data 69 $user_query = new WP_User_Query( 70 array( 71 'meta_query' => array( 72 array( 73 'key' => '_cw_purchase_code', 74 'value' => strval($input), 75 'compare' => 'like', 76 ) 77 ) 78 79 ) 80 ); 81 82 if ( $users = $user_query->get_results() ) { 62 83 63 84 return true; … … 99 120 } 100 121 122 } 123 124 /** 125 * Pulls all data from API and returns array. 126 * 127 * @since 0.2 128 * @access public 129 * @param mixed $purchase_code 130 * @return array 131 */ 132 function cw_get_purchase_data($purchase_code){ 133 134 global $verifi; 135 136 $market_class = $verifi->envato; 137 138 $test_name = $verifi->username; 139 140 $api_check = $market_class->verify_purchase( $test_name , $purchase_code); 141 142 $meta = array( 143 "purchase_code" => $purchase_code, 144 "item_name" =>$api_check->item_name, 145 "item_id" => $api_check->item_id, 146 "created_at" => $api_check->created_at, 147 "buyer" => $api_check->buyer , 148 "licence" => $api_check->licence 149 ); 150 151 return $meta; 152 101 153 } 102 154 ?> -
cloudwork-verifi/trunk/includes/cw-verifi-shortcode.php
r653724 r659769 1 1 <?php 2 // Exit if accessed directly 3 if ( !defined( 'ABSPATH' ) ) exit; 2 4 3 /** 5 4 * @package CloudWork Verifi 6 5 * @subpackage cw-verifi-shortcode.php 7 * @version 0. 1.26 * @version 0.2 8 7 * @author Chris Kelley <chris@organicbeemedia.com) 9 8 * @copyright Copyright © 2013 CloudWork Themes … … 24 23 */ 25 24 25 // Exit if accessed directly 26 if ( !defined( 'ABSPATH' ) ) exit; 27 26 28 if ( !class_exists( 'cw_Verfi_Shortcode' ) ) : 27 29 … … 320 322 update_user_option( $user_id, 'default_password_nag', true, true ); 321 323 322 update_user_meta( $user_id, '_cw_purchase_code' , $purchase_code ); 323 324 $meta = cw_get_purchase_data($purchase_code); 325 326 update_user_meta( $user_id, '_cw_purchase_code' , $meta ); 327 324 328 wp_new_user_notification( $user_id, $user_pass ); 325 329 -
cloudwork-verifi/trunk/readme.txt
r653724 r659769 25 25 1. Enjoy! 26 26 27 == Screenshots ==27 == Frequently Asked Questions == 28 28 29 = Does this plugin allow Users to have multiple API Keys = 30 31 Currently that is not supported 29 32 30 33 == Changelog == 31 32 = 0.1.2 = bug fixes 33 = 0.1.1 = typo fix 34 = 0.2 = 35 * _cw_purchase_code now stored as array with all buyer information 36 *squashy buggies 37 = 0.1.2 = 38 *bug fixes 39 = 0.1.1 = 40 *typo fix 34 41 = 0.1 = 35 42 * First
Note: See TracChangeset
for help on using the changeset viewer.