当前位置: 首页>>代码示例>>PHP>>正文


PHP affwp_get_affiliate_user_id函数代码示例

本文整理汇总了PHP中affwp_get_affiliate_user_id函数的典型用法代码示例。如果您正苦于以下问题:PHP affwp_get_affiliate_user_id函数的具体用法?PHP affwp_get_affiliate_user_id怎么用?PHP affwp_get_affiliate_user_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了affwp_get_affiliate_user_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: affwp_process_affiliate_deletion

/**
 * Process affiliate deletion requests
 *
 * @since 1.2
 * @param $data array
 * @return void
 */
function affwp_process_affiliate_deletion($data)
{
    if (!is_admin()) {
        return;
    }
    if (!current_user_can('manage_affiliates')) {
        wp_die(__('You do not have permission to delete affiliate accounts', 'affiliate-wp'), __('Error', 'affiliate-wp'), array('response' => 403));
    }
    if (!wp_verify_nonce($data['affwp_delete_affiliates_nonce'], 'affwp_delete_affiliates_nonce')) {
        wp_die(__('Security check failed', 'affiliate-wp'), __('Error', 'affiliate-wp'), array('response' => 403));
    }
    if (empty($data['affwp_affiliate_ids']) || !is_array($data['affwp_affiliate_ids'])) {
        wp_die(__('No affiliate IDs specified for deletion', 'affiliate-wp'), __('Error', 'affiliate-wp'), array('response' => 400));
    }
    $to_delete = array_map('absint', $data['affwp_affiliate_ids']);
    $delete_users = isset($data['affwp_delete_users_too']) && current_user_can('delete_users');
    foreach ($to_delete as $affiliate_id) {
        if ($delete_users) {
            require_once ABSPATH . 'wp-admin/includes/user.php';
            $user_id = affwp_get_affiliate_user_id($affiliate_id);
            if ((int) $user_id !== (int) get_current_user_id()) {
                // Don't allow a user to delete themself
                wp_delete_user($user_id);
            }
        }
        affwp_delete_affiliate($affiliate_id, true);
    }
    wp_safe_redirect(admin_url('admin.php?page=affiliate-wp-affiliates&affwp_notice=affiliate_deleted'));
    exit;
}
开发者ID:kknet,项目名称:AffiliateWP,代码行数:37,代码来源:actions.php

示例2: affwp_edd_restrict_commission_to_purchased_products

/**
 * Restrict commission to purchased products in Easy Digital Downloads
 *
 * Make sure to enable "Ignore Zero Referrals?" from Affiliates -> Settings -> Misc
 * If you would like 0.00 referrals to be ignored.
*/
function affwp_edd_restrict_commission_to_purchased_products($referral_amount, $affiliate_id, $amount, $reference, $product_id)
{
    // get referring affiliate ID
    $affiliate_id = affiliate_wp()->tracking->get_affiliate_id();
    // get user ID of referring affiliate
    $user_id = affwp_get_affiliate_user_id($affiliate_id);
    if (!(function_exists('edd_has_user_purchased') && edd_has_user_purchased($user_id, array($product_id)))) {
        $referral_amount = 0.0;
    }
    return $referral_amount;
}
开发者ID:companyjuice,项目名称:affiliatewp-code-snippet-library,代码行数:17,代码来源:restrict-commission-to-purchased-products-edd.php

示例3: affwp_affiliate_banners_get_banner

/**
 * Show a different image/banner/logo based on which affiliate is being tracked
 *
 * @since 1.0
 * @return string Image banner of affiliate
 */
function affwp_affiliate_banners_get_banner()
{
    // get the affiliate ID from query string
    $ref_var = isset($_GET[affiliate_wp()->tracking->get_referral_var()]) ? $_GET[affiliate_wp()->tracking->get_referral_var()] : '';
    // if affiliate ID is set in query string make sure they're actually an affiliate
    if (isset($ref_var) && affwp_is_affiliate(affwp_get_affiliate_user_id($ref_var))) {
        $affiliate_id = $ref_var;
    } elseif (affiliate_wp()->tracking->get_affiliate_id()) {
        $affiliate_id = affiliate_wp()->tracking->get_affiliate_id();
    } else {
        $affiliate_id = '';
    }
    // built out the image based on the image path of the affiliate
    return '<img src="' . affwp_affiliate_banners_get_image($affiliate_id) . '" />';
}
开发者ID:companyjuice,项目名称:affiliatewp-code-snippet-library,代码行数:21,代码来源:show-banner-by-referral-url.php

示例4: affwp_custom_registration_email

/**
 * Plugin Name: AffiliateWP - Custom Admin Registration Email
 * Plugin URI: http://affiliatewp.com
 * Description: Adds the Affiliate's Email and Affiliate ID to the admin registration email
 * Author: Andrew Munro
 * Author URI: http://affiliatewp.com
 * Version: 1.0
 */
function affwp_custom_registration_email($message, $args)
{
    $user_info = get_userdata(affwp_get_affiliate_user_id($args['affiliate_id']));
    $user_url = $user_info->user_url;
    $promotion_method = get_user_meta(affwp_get_affiliate_user_id($args['affiliate_id']), 'affwp_promotion_method', true);
    $message = "A new affiliate has registered on your site, " . home_url() . "\n\n";
    $message .= sprintf(__('Name: %s', 'affiliate-wp'), $args['name']) . "\n\n";
    // Affiliate's Email Address
    $message .= sprintf(__('Email: %s', 'affiliate-wp'), affwp_get_affiliate_email($args['affiliate_id'])) . "\n\n";
    // Affiliate's ID
    $message .= sprintf(__('Affiliate ID: %s', 'affiliate-wp'), $args['affiliate_id']) . "\n\n";
    if ($user_url) {
        $message .= __('Website URL: ', 'affiliate-wp') . esc_url($user_url) . "\n\n";
    }
    if ($promotion_method) {
        $message .= __('Promotion method: ', 'affiliate-wp') . esc_attr($promotion_method) . "\n\n";
    }
    if (affiliate_wp()->settings->get('require_approval')) {
        $message .= sprintf("Review pending applications: %s\n\n", admin_url('admin.php?page=affiliate-wp-affiliates&status=pending'));
    }
    return $message;
}
开发者ID:companyjuice,项目名称:affiliatewp-code-snippet-library,代码行数:30,代码来源:custom-admin-registration-email.php

示例5: affwp_notify_on_new_referral

/**
 * Send email on new referrals
 *
 * @since 1.6
 * @param int $affiliate_id The ID of the registered affiliate
 * @param array $referral
 */
function affwp_notify_on_new_referral($affiliate_id = 0, $referral)
{
    $user_id = affwp_get_affiliate_user_id($affiliate_id);
    if (!get_user_meta($user_id, 'affwp_referral_notifications', true)) {
        return;
    }
    if (empty($affiliate_id)) {
        return;
    }
    if (empty($referral)) {
        return;
    }
    $emails = new Affiliate_WP_Emails();
    $emails->__set('affiliate_id', $affiliate_id);
    $emails->__set('referral', $referral);
    $email = affwp_get_affiliate_email($affiliate_id);
    $subject = affiliate_wp()->settings->get('referral_subject', __('Referral Awarded!', 'affiliate-wp'));
    $message = affiliate_wp()->settings->get('referral_email', false);
    $amount = html_entity_decode(affwp_currency_filter($referral->amount), ENT_COMPAT, 'UTF-8');
    if (!$message) {
        $message = sprintf(__('Congratulations %s!', 'affiliate-wp'), affiliate_wp()->affiliates->get_affiliate_name($affiliate_id)) . "\n\n";
        $message .= sprintf(__('You have been awarded a new referral of %s on %s!', 'affiliate-wp'), $amount, home_url()) . "\n\n";
        $message .= sprintf(__('log into your affiliate area to view your earnings or disable these notifications: %s', 'affiliate-wp'), affiliate_wp()->login->get_login_url()) . "\n\n";
    }
    // $args is setup for backwards compatibility with < 1.6
    $args = array('affiliate_id' => $affiliate_id, 'amount' => $referral->amount, 'referral' => $referral);
    $subject = apply_filters('affwp_new_referral_subject', $subject, $args);
    $message = apply_filters('affwp_new_referral_email', $message, $args);
    if (apply_filters('affwp_notify_on_new_referral', true, $referral)) {
        $emails->send($email, $subject, $message);
    }
}
开发者ID:kknet,项目名称:AffiliateWP,代码行数:39,代码来源:actions.php

示例6: affwp_get_referral_format_value

/**
 * Get the referral format value
 *
 * @since 1.6
 * @param string $format referral format passed in via [affiliate_referral_url] shortcode
 * @return string affiliate ID or username
 */
function affwp_get_referral_format_value($format = '', $affiliate_id = 0)
{
    // get affiliate's user ID
    $user_id = affwp_get_affiliate_user_id($affiliate_id);
    if (!$format) {
        $format = affwp_get_referral_format();
    }
    switch ($format) {
        case 'username':
            $value = urlencode(affwp_get_affiliate_username($affiliate_id));
            break;
        case 'id':
        default:
            $value = affwp_get_affiliate_id($user_id);
            break;
    }
    return apply_filters('affwp_get_referral_format_value', $value, $format, $affiliate_id);
}
开发者ID:kjohnson,项目名称:AffiliateWP,代码行数:25,代码来源:misc-functions.php

示例7: get_affiliate_gravatar

 /**
  * Get the affiliate's gravatar
  *
  * @since 1.0.0
  */
 public function get_affiliate_gravatar()
 {
     $affiliate_id = $this->get_affiliate_id();
     if ($affiliate_id) {
         $args = apply_filters('affwp_affiliate_info_gravatar_defaults', array('size' => 96, 'default' => '', 'alt' => $this->get_affiliate_name()));
         $email = affwp_get_affiliate_email($affiliate_id);
         return get_avatar(affwp_get_affiliate_user_id($affiliate_id), $args['size'], $args['default'], $args['alt']);
     }
     return false;
 }
开发者ID:companyjuice,项目名称:affiliatewp-affiliate-info,代码行数:15,代码来源:class-functions.php

示例8: referral_payouts

 /**
  * Referral Payout
  * @since 1.6
  * @version 1.0
  */
 public function referral_payouts($referral_id, $new_status, $old_status)
 {
     // If the referral id isn't valid
     if (!is_numeric($referral_id)) {
         return;
     }
     // Get the referral object
     $referral = affwp_get_referral($referral_id);
     // Get the user id
     $user_id = affwp_get_affiliate_user_id($referral->affiliate_id);
     if (array_key_exists($currency, $this->point_types) && $this->prefs['referrals']['pay'] == 'store') {
         $amount = $referral->amount;
     } elseif ($this->prefs['referrals']['pay'] == 'amount') {
         $amount = $this->prefs['referrals']['creds'];
     } else {
         $amount = $this->core->number($referral->amount / $this->prefs['referrals']['creds']);
     }
     $amount = apply_filters('mycred_affiliatewp_payout', $amount, $referral, $new_status, $old_status, $this);
     if ('paid' === $new_status) {
         $this->core->add_creds('affiliate_referral', $user_id, $amount, $this->prefs['referrals']['log'], $referral_id, array('ref_type' => 'post'), $this->mycred_type);
     } elseif ('paid' === $old_status && 'unpaid' === $new_status) {
         $this->core->add_creds('affiliate_referral_refund', $user_id, 0 - $amount, $this->prefs['referrals']['remove_log'], $referral_id, array('ref_type' => 'post'), $this->mycred_type);
     }
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:29,代码来源:mycred-hook-affiliatewp.php

示例9: discount_edit

    /**
     * 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 
    }
开发者ID:rexcarnation,项目名称:AffiliateWP,代码行数:51,代码来源:class-rcp.php

示例10: affwp_update_profile_settings

/**
 * Updates an affiliate's profile settings
 *
 * @since 1.0
 * @return bool
 */
function affwp_update_profile_settings($data = array())
{
    if (!is_user_logged_in()) {
        return false;
    }
    if (empty($data['affiliate_id'])) {
        return false;
    }
    if (affwp_get_affiliate_id() != $data['affiliate_id'] && !current_user_can('manage_affiliates')) {
        return false;
    }
    $affiliate_id = absint($data['affiliate_id']);
    $user_id = affwp_get_affiliate_user_id($affiliate_id);
    if (!empty($data['referral_notifications'])) {
        update_user_meta($user_id, 'affwp_referral_notifications', '1');
    } else {
        delete_user_meta($user_id, 'affwp_referral_notifications');
    }
    if (!empty($data['payment_email']) && is_email($data['payment_email'])) {
        affiliate_wp()->affiliates->update($affiliate_id, array('payment_email' => $data['payment_email']), '', 'affiliate');
    }
    do_action('affwp_update_affiliate_profile_settings', $data);
    if (!empty($_POST['affwp_action'])) {
        wp_redirect(add_query_arg('affwp_notice', 'profile-updated'));
        exit;
    }
}
开发者ID:rexcarnation,项目名称:AffiliateWP,代码行数:33,代码来源:affiliate-functions.php

示例11: process_update_affiliate

 /**
  * Save affiliate details in admin backend.
  */
 public function process_update_affiliate()
 {
     $data = array_map('esc_attr', $_POST);
     $user_id = affwp_get_affiliate_user_id(absint($_GET['affiliate_id']));
     $bank_details = array('bank_name' => $data['bank_name'], 'account_name' => $data['account_name'], 'account_number' => $data['account_number'], 'phone_number' => $data['phone_number']);
     update_user_meta($user_id, 'affwp_bank_details', $bank_details);
 }
开发者ID:affiliateshop,项目名称:affwp-bank-info,代码行数:10,代码来源:affwp-bank-info.php

示例12: test_get_affiliate_user_id

 function test_get_affiliate_user_id()
 {
     $this->assertEquals($this->_user_id, affwp_get_affiliate_user_id($this->_affiliate_id));
 }
开发者ID:jwondrusch,项目名称:AffiliateWP,代码行数:4,代码来源:test-affiliates.php

示例13: affwp_custom_auto_enable_affiliate_referral_notifications

/**
 * Plugin Name: AffiliateWP - Auto Enable Affiliate Referral Notifications
 * Plugin URI: http://affiliatewp.com
 * Description: Auto enables the "Enable New Referral Notifications" checkbox on the "Settings" tab of the affiliate area when an affiliate is added
 * Author: Andrew Munro
 * Author URI: http://affiliatewp.com
 * Version: 1.0
 */
function affwp_custom_auto_enable_affiliate_referral_notifications($add)
{
    update_user_meta(affwp_get_affiliate_user_id($add), 'affwp_referral_notifications', true);
}
开发者ID:companyjuice,项目名称:affiliatewp-code-snippet-library,代码行数:12,代码来源:auto-enable-new-referral-notifications.php

示例14: after_referral_completed

function after_referral_completed($referral_id, $new_status, $old_status)
{
    if ('paid' == $new_status) {
        $referral = affiliate_wp()->referrals->get_by('referral_id', $referral_id);
        $affiliate_id = $referral->affiliate_id;
        $user_id = affwp_get_affiliate_user_id($affiliate_id);
        $points = get_user_meta($user_id, 'loyalty_points', true) + 1;
        update_user_meta($user_id, 'loyalty_points', $points);
    }
}
开发者ID:keyshames,项目名称:tcm2016,代码行数:10,代码来源:functions.20151230.php

示例15: pw_affwp_set_role_on_registration

/**
 * Plugin Name: AffiliateWP - Affiliate role on registration
 * Plugin URI: http://affiliatewp.com
 * Description: Sets an affiliate user's role to a specific role when being added as an affiliate
 * Author: Pippin Williamson
 * Author URI: http://pippinsplugins.com
 * Version: 1.0
 */
function pw_affwp_set_role_on_registration($affiliate_id = 0)
{
    $user_id = affwp_get_affiliate_user_id($affiliate_id);
    $user = new WP_User($user_id);
    $user->add_role('affiliate');
}
开发者ID:companyjuice,项目名称:affiliatewp-code-snippet-library,代码行数:14,代码来源:affiliate-role-on-registration.php


注:本文中的affwp_get_affiliate_user_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。