Plugin Directory

Changeset 659769


Ignore:
Timestamp:
01/27/2013 05:00:34 PM (13 years ago)
Author:
cloudworkthemes
Message:

new version, bug fixes

Location:
cloudwork-verifi/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cloudwork-verifi/trunk/cw-verifi.php

    r653724 r659769  
    11<?php
    2 // Exit if accessed directly
    3 if ( !defined( 'ABSPATH' ) ) exit;
    42/*
    53Plugin Name: CloudWork Verifi
    64Plugin URI: http://cloudworkthemes.com
    75Description: Uses Envato API to verify purchase at registration, prevents duplicate purchase codes
    8 Version: 0.1.2
     6Version: 0.2
    97Author: Chris Kelley <chris@organicbeemedia.com>
    108Author URI: http://cloudworkthemes.com
     
    2725*/
    2826
     27// Exit if accessed directly
     28if ( !defined( 'ABSPATH' ) ) exit;
     29
    2930if ( !class_exists( 'cw_Verifi' ) ) :
    3031
     
    247248     *
    248249     * @since 0.1
     250     * @uses cw_get_purcahse_data
    249251     * @access public
    250252     * @param mixed $user_id
     
    253255    function register_field( $user_id ){
    254256   
    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        }
    259265
    260266    }
  • cloudwork-verifi/trunk/includes/cw-verifi-admin.php

    r653724 r659769  
    11<?php
    2 // Exit if accessed directly
    3 if ( !defined( 'ABSPATH' ) ) exit;
    42/**
    53 * @package CloudWork Verifi
    64 * @subpackage cw-verifi-admin.php
    7  * @version 0.1.2
     5 * @version 0.2
    86 * @author Chris Kelley <chris@organicbeemedia.com)
    97 * @copyright Copyright � 2013 CloudWork Themes
     
    2119 *
    2220*/
     21
     22// Exit if accessed directly
     23if ( !defined( 'ABSPATH' ) ) exit;
     24
    2325if ( !class_exists( 'cw_Verifi_admin' ) ) :
    2426
  • cloudwork-verifi/trunk/includes/cw-verifi-functions.php

    r653724 r659769  
    55 * @package CloudWork Verifi
    66 * @subpackage cw-verifi-functions.php
    7  * @version 0.1.2
     7 * @version 0.2
    88 * @author Chris Kelley <chris@organicbeemedia.com)
    99 * @copyright Copyright © 2013 CloudWork Themes
     
    1616 * cw_purchase_exists
    1717 * cw_validate_api
     18 * cw_get_purchase_data
    1819 *
    1920*/
    2021
     22// Exit if accessed directly
     23if ( !defined( 'ABSPATH' ) ) exit;
     24
    2125/**
    2226* 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*
    2430* @thanks Tom Mcfarlin http://tommcfarlin.com
    2531* @since 0.1
     32* @uses WP_User_Query
    2633* @access public
    2734* @param mixed $meta_key
     
    5259*
    5360* @since 0.1
    54 * @uses cw_get_user_by_meta
     61* @uses WP_User_Query
    5562* @access public
    5663* @param mixed $cw_purcahse_code
     
    5966function cw_purchase_exists( $input ) {
    6067
    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() ) {
    6283   
    6384        return true;
     
    99120    }
    100121   
     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 */
     132function 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   
    101153}   
    102154?>
  • cloudwork-verifi/trunk/includes/cw-verifi-shortcode.php

    r653724 r659769  
    11<?php
    2 // Exit if accessed directly
    3 if ( !defined( 'ABSPATH' ) ) exit;
     2
    43/**
    54 * @package CloudWork Verifi
    65 * @subpackage cw-verifi-shortcode.php
    7  * @version 0.1.2
     6 * @version 0.2
    87 * @author Chris Kelley <chris@organicbeemedia.com)
    98 * @copyright Copyright © 2013 CloudWork Themes
     
    2423*/
    2524
     25// Exit if accessed directly
     26if ( !defined( 'ABSPATH' ) ) exit;
     27
    2628if ( !class_exists( 'cw_Verfi_Shortcode' ) ) :
    2729
     
    320322            update_user_option( $user_id, 'default_password_nag', true, true );
    321323   
    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           
    324328            wp_new_user_notification( $user_id, $user_pass );
    325329           
  • cloudwork-verifi/trunk/readme.txt

    r653724 r659769  
    25251. Enjoy!
    2626
    27 == Screenshots ==
     27== Frequently Asked Questions ==
    2828
     29= Does this plugin allow Users to have multiple API Keys =
     30
     31Currently that is not supported
    2932
    3033== 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
    3441= 0.1 =
    3542* First
Note: See TracChangeset for help on using the changeset viewer.