예제 #1
0
    /**
     * Shows the affiliate drop down on the discount edit / add screens
     *
     * @access  public
     * @since   1.7.5
     */
    public function coupon_option($edit)
    {
        global $wpdb;
        add_filter('affwp_is_admin_page', '__return_true');
        affwp_admin_scripts();
        $user_id = 0;
        $user_name = '';
        if ($edit > 0) {
            $table = $wpdb->prefix . 'affiliate_wp_affiliatemeta';
            $affiliate_id = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$table} WHERE meta_key = %s", 'affwp_discount_pmp_' . $edit));
        } else {
            $affiliate_id = false;
        }
        if ($affiliate_id) {
            $user_id = affwp_get_affiliate_user_id($affiliate_id);
            $user = get_userdata($user_id);
            $user_name = $user ? $user->user_login : '';
        }
        ?>
		<table class="form-table">
			<tbody>
				<tr>
					<th scope="row" valign="top"><label for="user_name"><?php 
        _e('Affiliate Discount?', 'affiliate-wp');
        ?>
</label></th>
					<td class="form-field affwp-pmp-coupon-field">
						<span class="affwp-ajax-search-wrap">
							<span class="affwp-pmp-coupon-input-wrap">
								<input type="hidden" name="user_id" id="user_id" value="<?php 
        echo esc_attr($user_id);
        ?>
" />
								<input type="text" name="user_name" id="user_name" value="<?php 
        echo esc_attr($user_name);
        ?>
" class="affwp-user-search" data-affwp-status="active" autocomplete="off" style="width:150px" />
								<img class="affwp-ajax waiting" src="<?php 
        echo admin_url('images/wpspin_light.gif');
        ?>
" style="display: none;"/>
							</span>
							<span id="affwp_user_search_results"></span>
							<small class="pmpro_lite"><?php 
        _e('If you would like to connect this discount to an affiliate, enter the name of the affiliate it belongs to.', 'affiliate-wp');
        ?>
</small>
						</span>
						<?php 
        wp_nonce_field('affwp_pmp_coupon_nonce', 'affwp_pmp_coupon_nonce');
        ?>
					</td>
				</tr>
			</tbody>
		</table>
		<?php 
    }
예제 #2
0
    /**
     * Shows the affiliate drop down on the coupon edit / add screens
     *
     * @access  public
     * @since   1.3
     */
    public function coupon_edit($form)
    {
        add_filter('affwp_is_admin_page', '__return_true');
        affwp_admin_scripts();
        $coupon_id = !empty($_REQUEST['post']) ? absint($_REQUEST['post']) : 0;
        $affiliate_id = get_post_meta($coupon_id, 'affwp_coupon_affiliate', true);
        $user_id = affwp_get_affiliate_user_id($affiliate_id);
        $user = get_userdata($user_id);
        $user_name = $user ? $user->user_login : '';
        ?>
		<div class="field affwp-coupon">
			<th scope="row" valign="top">
				<label for="user_name"><?php 
        _e('Affiliate coupon?', 'affiliate-wp');
        ?>
</label>
			</th>
			<td>
				<span class="affwp-ajax-search-wrap">
					<input type="hidden" name="user_id" id="user_id" value="<?php 
        echo esc_attr($user_id);
        ?>
" />
					<input type="text" name="user_name" id="user_name" value="<?php 
        echo esc_attr($user_name);
        ?>
" class="affwp-user-search" data-affwp-status="active" autocomplete="off" />
					<img class="affwp-ajax waiting" src="<?php 
        echo admin_url('images/wpspin_light.gif');
        ?>
" style="display: none;"/>
				</span>
				<div id="affwp_user_search_results"></div>
				<p class="description"><?php 
        _e('If you would like to connect this coupon to an affiliate, enter the name of the affiliate it belongs to.', 'affiliate-wp');
        ?>
</p>
			</td>
		</div>
<?php 
    }
예제 #3
0
    /**
     * Shows the affiliate drop down on the discount edit / add screens
     *
     * @access  public
     * @since   1.1
     */
    public function discount_edit($discount_id = 0)
    {
        global $wpdb;
        add_filter('affwp_is_admin_page', '__return_true');
        affwp_admin_scripts();
        $affiliate_id = $wpdb->get_var($wpdb->prepare("SELECT meta_value FROM {$wpdb->usermeta} WHERE meta_key = %s", 'affwp_discount_rcp_' . $discount_id));
        $user_id = affwp_get_affiliate_user_id($affiliate_id);
        $user = get_userdata($user_id);
        $user_name = $user ? $user->user_login : '';
        ?>
		<table class="form-table">
			<tbody>
				<tr class="form-field">
					<th scope="row" valign="top">
						<label for="affiliate_id"><?php 
        _e('Affiliate Discount?', 'affiliate-wp');
        ?>
</label>
					</th>
					<td>
						<span class="affwp-ajax-search-wrap">
							<input type="hidden" name="user_id" id="user_id" value="<?php 
        echo esc_attr($user_id);
        ?>
" />
							<input type="text" name="user_name" id="user_name" value="<?php 
        echo esc_attr($user_name);
        ?>
" class="affwp-user-search" data-affwp-status="active" autocomplete="off" style="width: 300px;" />
							<img class="affwp-ajax waiting" src="<?php 
        echo admin_url('images/wpspin_light.gif');
        ?>
" style="display: none;"/>
						</span>
						<div id="affwp_user_search_results"></div>
						<p class="description"><?php 
        _e('If you would like to connect this discount to an affiliate, enter the name of the affiliate it belongs to.', 'affiliate-wp');
        ?>
</p>
					</td>
				</tr>
			</tbody>
		</table>
<?php 
    }
예제 #4
0
    /**
     * Shows the affiliate drop down on the discount edit / add screens
     *
     * @access  public
     * @since   1.1
     */
    public function coupon_option()
    {
        global $post;
        add_filter('affwp_is_admin_page', '__return_true');
        affwp_admin_scripts();
        $affiliate_id = get_post_meta($post->ID, 'affwp_discount_affiliate', true);
        $user_id = affwp_get_affiliate_user_id($affiliate_id);
        $user = get_userdata($user_id);
        $user_name = $user ? $user->user_login : '';
        ?>
		<p class="form-field affwp-woo-coupon-field">
			<label for="user_name"><?php 
        _e('Affiliate Discount?', 'affiliate-wp');
        ?>
</label>
			<span class="affwp-ajax-search-wrap">
				<span class="affwp-woo-coupon-input-wrap">
					<input type="hidden" name="user_id" id="user_id" value="<?php 
        echo esc_attr($user_id);
        ?>
" />
					<input type="text" name="user_name" id="user_name" value="<?php 
        echo esc_attr($user_name);
        ?>
" class="affwp-user-search" data-affwp-status="active" autocomplete="off" />
					<img class="affwp-ajax waiting" src="<?php 
        echo admin_url('images/wpspin_light.gif');
        ?>
" style="display: none;"/>
				</span>
				<span id="affwp_user_search_results"></span>
				<img class="help_tip" data-tip='<?php 
        _e('If you would like to connect this discount to an affiliate, enter the name of the affiliate it belongs to.', 'affiliate-wp');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" />
			</span>
		</p>
<?php 
    }