Esempio n. 1
0
function AM_Show_Affiliate_Settings($settings)
{
    if (isset($_POST['gateway_settings'])) {
        // Do processing here
        if (!empty($_POST['affiliate_mp_percentage']) && $_POST['affiliate_mp_percentage'] > 0) {
            aff_update_option('affiliate_mp_percentage', $_POST['affiliate_mp_percentage']);
        } else {
            aff_delete_option('affiliate_mp_percentage');
        }
    }
    ?>
		<div id="mp_gateways" class="postbox">
            <h3 class='hndle'><span><?php 
    _e('Affiliate Settings', 'mp');
    ?>
</span></h3>
            <div class="inside">
			  <span class="description"><?php 
    _e('You can set the global commision amount paid to affiliates for referred purchases below. Set it to 0 for no payments.', 'affiliate');
    ?>
</span>
              <table class="form-table">
                <tr>
        				<th scope="row"><?php 
    _e('Set percentage to be paid to affiliates', 'affiliate');
    ?>
</th>
        				<td>
							<?php 
    $percentage = aff_get_option('affiliate_mp_percentage', 0);
    ?>
							<input type='text' name='affiliate_mp_percentage' value='<?php 
    echo number_format($percentage, 2);
    ?>
' style='width:5em;'/>&nbsp;<?php 
    _e('%', 'affiliate');
    ?>
                			<?php 
    ?>
        				</td>
                </tr>
              </table>
            </div>
          </div>
	<?php 
}
Esempio n. 2
0
 function handle_affiliate_settings_panel()
 {
     if (isset($_GET['action']) && addslashes($_GET['action']) == 'updateaffiliateoptions') {
         check_admin_referer('affiliateoptions');
         //echo "_POST<pre>"; print_r($_POST); echo "</pre>";
         //die();
         $headings = array();
         $headings[] = $_POST['uniqueclicks'];
         $headings[] = $_POST['signups'];
         $headings[] = $_POST['paidmembers'];
         aff_update_option('affiliateheadings', $headings);
         aff_update_option('affiliatesettingstext', $_POST['affiliatesettingstext']);
         aff_update_option('affiliateadvancedsettingstext', $_POST['affiliateadvancedsettingstext']);
         aff_update_option('affiliateenablebanners', $_POST['affiliateenablebanners']);
         aff_update_option('affiliateenableapproval', $_POST['affiliateenableapproval']);
         if (!empty($_POST['affiliatelinkurl'])) {
             aff_update_option('affiliatelinkurl', $_POST['affiliatelinkurl']);
         } else {
             aff_delete_option('affiliatelinkurl');
         }
         if (isset($_POST['affiliate-currency-paypal-masspay']) && !empty($_POST['affiliate-currency-paypal-masspay'])) {
             aff_update_option('affiliate-currency-paypal-masspay', $_POST['affiliate-currency-paypal-masspay']);
         } else {
             aff_delete_option('affiliate-currency-paypal-masspay');
         }
         $banners = explode("\n", stripslashes($_POST['affiliatebannerlinks']));
         foreach ($banners as $key => $b) {
             $banners[$key] = trim($b);
         }
         aff_update_option('affiliatebannerlinks', $banners);
         do_action('affililate_settings_form_update');
         echo '<div id="message" class="updated fade"><p>' . __('Affiliate settings saved.', 'affiliate') . '</p></div>';
     }
     $page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
     $subpage = isset($_GET['subpage']) ? esc_attr($_GET['subpage']) : '';
     echo '<div  id="poststuff" class=class="metabox-holder m-settings">';
     echo '<form method="post" action="?page=' . $page . '&amp;subpage=' . $subpage . '&amp;action=updateaffiliateoptions">';
     wp_nonce_field("affiliateoptions");
     show_affiliate_admin_metabox_reports_affiliate_link();
     //show_affiliate_admin_metabox_reports_monetary_precision();
     show_affiliate_admin_metabox_settings_paypal_masspay_currency();
     show_affiliate_admin_metabox_reports_column_settings();
     show_affiliate_admin_metabox_profile_text();
     show_affiliate_admin_metabox_settings_banner();
     show_affiliate_admin_metabox_settings_approval();
     do_action('affililate_settings_form');
     echo '<p class="submit">';
     echo '<input type="submit" name="Submit" value="' . __('Update Settings', 'affiliate') . '" class="button-primary" /></p>';
     echo '</form>';
     echo '</div>';
     echo "</div>";
 }