Changeset 2047794
- Timestamp:
- 03/10/2019 11:36:39 PM (7 years ago)
- Location:
- really-simple-affiliate-program
- Files:
-
- 6 added
- 2 edited
-
tags/1.1 (added)
-
tags/1.1/affiliateCodeEmailTemplate.php (added)
-
tags/1.1/js (added)
-
tags/1.1/js/rsap_main.js (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/really-simple-affiliate-program.php (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/really-simple-affiliate-program.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
really-simple-affiliate-program/trunk/readme.txt
r2047630 r2047794 16 16 * User will receive a beautiful email with their affiliate code and link, making it easy for them to start sharing about your product right away. 17 17 * You have the option of restricting 'referral' submissions by IP address, meaning that one person can't submit the form many times in their own home and make it look like they brought in legitimate referrals. 18 * Easy to use shortcode for displaying the referrer affiliate code in an email that is send out from a 'conversion form' such as Contact Form 7. 18 19 19 20 20 == Special Thanks==21 == Changelog == 21 22 23 = 1.1 = 24 25 * Added 'rsap_referrer_code' shortcode to allow the affiliate code to be easily placed in a form submission email (as with Contact Form 7), or somewhere on the 'conversion form' page. 26 27 = 1.0 = 28 29 * Initial release. 30 * Includes IP restriction to prevent spam submissions from one person. 31 * Includes shortcode to easily display the affiliate signup form. -
really-simple-affiliate-program/trunk/really-simple-affiliate-program.php
r2047630 r2047794 141 141 add_option( 'rsap_option_conversion_form_wrapper_id', 'contact-form'); 142 142 register_setting( 'rsap_options_group', 'rsap_option_conversion_form_wrapper_id', 'rsap_callback' ); 143 add_option( 'rsap_option_enable_ip_restriction', true);143 add_option( 'rsap_option_enable_ip_restriction', false); 144 144 register_setting( 'rsap_options_group', 'rsap_option_enable_ip_restriction', 'rsap_callback' ); 145 145 add_option( 'rsap_option_days_before_new_submission_allowed', '7'); … … 173 173 </ol> 174 174 175 <h2>For Outputting the Affiliate Code in a Form Submission Email (CF7) or on a Website Page</h2> 176 <ul> 177 <li>This shortcode can be used to display the affiliate code on the 'conversion form page', or added to a form submission email (like in Contact Form 7): <code>[rsap_referrer_code]</code>. </li> 178 </ul> 175 179 <h2>RSAP Settings</h2> 176 180 <form method="post" action="options.php"> … … 342 346 } 343 347 348 344 349 function rsap_log_referral_normally($referrerCode, $sourceIpAddress){ 345 350 global $wpdb; 351 346 352 $table_name = $wpdb->prefix . 'rsap_affiliates'; 347 353 … … 381 387 382 388 383 389 // Shortcode for the user to put an affiliate code in a form output email 390 function rsap_output_referrer_code() { 391 392 $urlReferrerCode = $_GET['rfr']; 393 394 if ($urlReferrerCode != '') { 395 return '' . $urlReferrerCode . ''; 396 } else { 397 global $wpdb; 398 399 $sourceIpAddress = (string)$_SERVER['REMOTE_ADDR']; 400 $table_name_log = $wpdb->prefix . 'rsap_referral_log'; 401 $getLastReferralCodeFromIp = ''; 402 $getLastReferralIp = ''; 403 404 // Get the latest referral code logged from this IP address 405 $getLastReferralCodeFromIpQuery = $wpdb->get_results( "SELECT `code`,`logged`,`source_ip` FROM $table_name_log WHERE source_ip = '" . $sourceIpAddress . "' ORDER BY `logged` DESC" ); 406 407 try { 408 $getLastReferralCodeFromIp = (string)$getLastReferralCodeFromIpQuery[0]->code; 409 $getLastReferralIp = (string)$getLastReferralCodeFromIpQuery[0]->source_ip; 410 } 411 catch(Exception $e) { 412 // Log entry for that IP not found 413 } 414 415 return '' . $getLastReferralCodeFromIp . ''; 416 } 417 418 419 } 420 add_shortcode('rsap_referrer_code', 'rsap_output_referrer_code'); 421 422 423 // Enable shortcode for contact form 7 - code reference from https://www.howtosnippets.net/wordpress/make-custom-shortcodes-work-in-contact-form-7-mail-form-templates/ 424 function rsap_special_mail_tag( $output, $name, $html ) { 425 426 if ( 'rsap_referrer_code' == $name ) 427 $output = do_shortcode( "[$name]" ); 428 429 return $output; 430 } 431 add_filter( 'wpcf7_special_mail_tags', 'rsap_special_mail_tag', 10, 3 ); 384 432 385 433 // Shortcode for the form 386 // Function to add subscribe text to posts and pages387 434 function rsap_affiliate_form_shortcode() { 388 435 return ' … … 411 458 add_shortcode('rsap_form', 'rsap_affiliate_form_shortcode'); 412 459 460 461 413 462 // Enqueue JS file that will listed for the form submit 414 463 … … 432 481 $plugin = plugin_basename( __FILE__ ); 433 482 add_filter( "plugin_action_links_$plugin", 'rsap_add_settings_link' ); 434
Note: See TracChangeset
for help on using the changeset viewer.