prefix."revenue_setting"; $user_id = get_current_user_id(); $current_user = wp_get_current_user(); $role = $current_user->roles; if($role[0]=="administrator"){ $where = " user_role = 'administrator'"; } else{ $where = " user_id = '".$user_id."'"; } $get_data = "SELECT * FROM ".$tbl_revenue_setting." WHERE $where"; $exec_query = mysql_query($get_data); $revenue_data = array(); while($val = mysql_fetch_array($exec_query)){ $revenue_data[] = $val; } if(isset($_POST['add_aff_id'])){ foreach($_POST as $ind=>$value){ $$ind = $value; if(strpos($ind, 'amazon') !== false and count($revenue_data)==0){ $domain_name = str_replace('_', '.', $ind); $wpdb->insert( $tbl_revenue_setting, array( 'domain_name' => $domain_name, 'affiliate_id' => $value, 'user_id' => $user_id, 'user_role' => $role[0] ) ); }else if(strpos($ind, 'amazon') !== false and count($revenue_data)>0){ $domain_name = str_replace('_', '.', $ind); if($role[0]=="administrator"){ $wpdb->update( $tbl_revenue_setting, array( 'affiliate_id' => $value ), array( 'domain_name' => $domain_name, 'user_role' => 'administrator') ); }else{ $wpdb->update( $tbl_revenue_setting, array( 'affiliate_id' => $value ), array( 'domain_name' => $domain_name, 'user_id' => $user_id) ); } } } if(!empty($amount_share_author) and !empty($amount_your) and !empty($amount_plugin)){ $amount_data = array( 'author_amount'=> $amount_share_author, 'your_amount'=>$amount_your , 'plugin_amount'=>$amount_plugin ); update_option( "Sharing_revenue_amount", serialize( $amount_data ),true ); } } $get_data = "SELECT * FROM ".$tbl_revenue_setting." WHERE $where"; $exec_query = mysql_query($get_data); $revenue_data = array(); while($val = mysql_fetch_array($exec_query)){ $revenue_data[] = $val; } // print_r( maybe_unserialize('Sharing_revenue_amount')); $sharingAmounts = get_option('Sharing_revenue_amount'); ?>

Add New Affiliate ID

Enter admin affiliate IDs. If you have not set up IDs for each country just leave it blank for now.

Revenue Sharing

If you enter 25 then on posts by other authors 25 out of 100 links will be with their IDs and 75 will be with yours.

" id="amount_plugin" name="amount_plugin">

Please consider donating a portion of your links to help support this plugin. Any amount put here will help tremendously!