Help with register modification
-
Hi there I am trying to edit the Facebook AWD Login button plugin to include a hook upon registering so I can track affiliate referrals
I have found this script below but now I need to tailor it to the Facebook AWD script.
add_action('register_form','show_reff_field'); function show_reff_field(){ ?> <input id="ref" type="text" tabindex="20" size="25" value= "<?php if (isset($_GET['ref'])){echo $_GET['ref'];} ?>" name="ref" readonly="readonly"/> <?php }add_action('user_register', 'register_refferal'); function register_refferal($user_id) { $userdata = array(); $userdata['ID'] = $user_id; wp_update_user($userdata); $userdata['ref'] = $_POST['ref']; if (isset($userdata['ref']) && !empty($userdata['ref']) && $userdata['ref'] != ""){ //get reffering user id by his login $refuser = get_userdatabylogin($userdata['ref']); //get current refferial credit that user has $current_ref_credit = get_user_meta($refuser->ID, 'ref_credit', true); //add credit for the newly created user $current_ref_credit[] = $user_id; //save the changes update_user_meta( $refuser->ID, 'ref_credit', $current_ref_credit); } }
The topic ‘Help with register modification’ is closed to new replies.