Exemplo n.º 1
0
function fn_affiliate_update_profile($action, $user_data)
{
    if ($action == 'add' && in_array($user_data['user_type'], array('P', 'C'))) {
        $partner_action = $user_data['user_type'] == 'P' ? 'new_partner' : 'new_customer';
        if (!empty($_SESSION['partner_data']['partner_id'])) {
            fn_add_partner_action($partner_action, @$_SESSION['partner_data']['banner_id'], $_SESSION['partner_data']['partner_id'], $user_data['user_id']);
            if ($user_data['user_type'] == 'P') {
                fn_update_partner_profile($user_data['user_id'], array('referrer_partner_id' => $_SESSION['partner_data']['partner_id']));
            }
        }
    }
    return true;
}
Exemplo n.º 2
0
                    $user_data = fn_get_user_info($partner_id);
                    $view_mail->assign('user_data', $user_data);
                    // Send notification to partners
                    fn_send_mail($user_data['email'], Registry::get('settings.Company.company_users_department'), 'affiliate/approved_subj.tpl', 'affiliate/approved_body.tpl');
                }
            }
        }
    }
    if ($mode == 'm_decline') {
        if (!empty($_REQUEST['partner_ids'])) {
            $view_mail->assign('reason_declined', $_REQUEST['action_reason_declined']);
            foreach ($_REQUEST['partner_ids'] as $partner_id) {
                $_data = fn_get_partner_data($partner_id);
                if (empty($_data['approved']) || $_data['approved'] != 'D') {
                    $p_data = array('approved' => 'D');
                    $update_result = fn_update_partner_profile($partner_id, $p_data);
                    if ($update_result) {
                        $user_data = fn_get_user_info($partner_id, false);
                        $view_mail->assign('user_data', $user_data);
                        // Send notification to partners
                        fn_send_mail($user_data['email'], Registry::get('settings.Company.company_users_department'), 'affiliate/declined_subj.tpl', 'affiliate/declined_body.tpl');
                    }
                }
            }
        }
    }
    return array(CONTROLLER_STATUS_REDIRECT, "partners.manage");
}
if ($mode == 'update' && !empty($_REQUEST['user_id'])) {
    $partner_data = fn_get_partner_data($_REQUEST['user_id']);
    if (empty($partner_data)) {