← All changes
|
integrations/affiliatepress/includes/functions.php
+47
-0
5.7.9.2
→
6.0.3
View file →
| @@ -1,0 +1,47 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Functions | |
| 4 | + * | |
| 5 | + * @package AutomatorWP\Integrations\AffilatePress | |
| 6 | + * @since 1.0.0 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +// Exit if accessed directly | |
| 10 | +if ( ! defined( 'ABSPATH' ) ) exit; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Get WordPress user ID by affiliate ID | |
| 14 | + * | |
| 15 | + * @since 1.0.0 | |
| 16 | + * | |
| 17 | + * @param int $affiliate_id | |
| 18 | + */ | |
| 19 | +function automatorwp_affiliatepress_get_user_id ( $affiliate_id ) { | |
| 20 | + | |
| 21 | + global $wpdb; | |
| 22 | + | |
| 23 | + $table_name = $wpdb->prefix . 'affiliatepress_affiliates'; | |
| 24 | + $user_id = $wpdb->get_var( $wpdb->prepare( "SELECT ap_affiliates_user_id FROM $table_name WHERE ap_affiliates_id = %d", $affiliate_id ) ); | |
| 25 | + | |
| 26 | + return $user_id; | |
| 27 | + | |
| 28 | +} | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * Get affiliate ID by payout ID | |
| 32 | + * | |
| 33 | + * @since 1.0.0 | |
| 34 | + * | |
| 35 | + * @param int $payout_id | |
| 36 | + */ | |
| 37 | +function automatorwp_affiliatepress_get_affiliate_id_by_payout ( $payout_id ) { | |
| 38 | + | |
| 39 | + global $wpdb; | |
| 40 | + | |
| 41 | + $table_name = $wpdb->prefix . 'affiliatepress_payouts'; | |
| 42 | + $affiliate_id = $wpdb->get_var( $wpdb->prepare( "SELECT ap_payout_selected_affiliate FROM $table_name WHERE ap_payout_id = %d", $payout_id ) ); | |
| 43 | + | |
| 44 | + return $affiliate_id; | |
| 45 | + | |
| 46 | +} | |
| 47 | + | |