Пример #1
0
// Process any updates
// --- NONE ---
// Do queries and create content
$query_member_info = '
  SELECT
    *
  FROM ' . TABLE_MEMBER . '
  LEFT JOIN ' . TABLE_MEMBERSHIP_TYPES . ' USING (membership_type_id)
  WHERE
    member_id = "' . mysql_real_escape_string($member_id) . '"';
$result_member_info = @mysql_query($query_member_info, $connection) or die(debug_print("ERROR: 785033 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
$member_data_found = false;
if ($row_member_info = mysql_fetch_array($result_member_info)) {
    $member_data_found = true;
}
$renewal_info = check_membership_renewal(get_membership_info($member_id));
$member_content = '
  <div id="member_info_main">
    <div id="member_status">
      <span class="member_id">' . $row_member_info['member_id'] . '</span>
      <span class="pending">' . ($row_member_info['pending'] == 1 ? 'PENDING' : '') . '</span>
      <span class="discontinued">' . ($row_member_info['membership_discontinued'] == 1 ? 'DISCONTINUED' : '') . '</span>
    </div>
    <div id="shopping_status">
      <span class="customer_fee">' . number_format($row_member_info['customer_fee_percent'], 3) . '%</span>
      <span class="tax_exempt">' . ($row_member_info['mem_taxexempt'] == 1 ? '(TAX EXEMPT)' : '') . '</span>
      <span class="auth_type">' . implode(', ', explode(',', strtr($row_member_info['auth_type'], '_', ' '))) . '</span>
    </div>
    <div id="member_name">
      <span class="username">' . $row_member_info['username'] . '</span>
      <span class="preferred_name">' . $row_member_info['preferred_name'] . '</span>
Пример #2
0
}
$do_update_membership = false;
// Check if this is a forced update or if it is member-requested
if ($_SESSION['renewal_info']['membership_expired']) {
    // Don't allow a member-request to spoof a forced update
    $member_request = false;
    $do_update_membership = true;
} else {
    $member_request = true;
    $do_update_membership = true;
}
// Display the update membership form
if ($do_update_membership == true) {
    include_once 'func.check_membership.php';
    $membership_info = get_membership_info($_SESSION['member_id']);
    $membership_renewal = check_membership_renewal($membership_info);
    $membership_renewal_form = membership_renewal_form($membership_info);
    // Block the page with a renewal form (but allow member-requested forms to be closed
    $renew_membership_form = '
      <div id="membership_renewal_content">';
    if ($member_request == true) {
        // Instructions for optional membership changes
        $renew_membership_form .= '
          <h3>Change Membership Type</h3>
          <p>Depending on the changes you are making, this could adversely affect your renewal date and/or other membership priviliges with the ' . ORGANIZATION_TYPE . '. Multiple changes might result in additional membership dues that will need to be manually adjusted. For additional help, please contact <a href="mailto:' . MEMBERSHIP_EMAIL . '?Subject=Changing%20Membership%20(member%20#' . $_SESSION['member_id'] . ')">' . MEMBERSHIP_EMAIL . '</a>.</p>
          <p>Select from the option(s) below to change your membership type:</p>';
    } else {
        // Instructions for mandatory membership changes
        $renew_membership_form .= '
          <h3>Membership Renewal</h3>
          <p>' . $membership_renewal_form['expire_message'] . ' Any charges will be added to your next ordering invoice.</p>
Пример #3
0
<?php

include_once 'config_openfood.php';
session_start();
valid_auth('member');
// So paypal_utilities knows this is a local request and not a paypal request
$not_from_paypal = true;
include_once 'paypal_utilities.php';
// Do we need to post membership changes?
if ($_POST['update_membership'] == 'true') {
    include_once 'func.check_membership.php';
    renew_membership($_SESSION['member_id'], $_POST['membership_type_id']);
    // Now update our session membership values
    $membership_info = get_membership_info($_SESSION['member_id']);
    $_SESSION['renewal_info'] = check_membership_renewal($membership_info);
    // Make sure this function does not run again from the template_header.php
    $_POST['update_membership'] = 'false';
}
// Set up English grammar for ordering dates
$relative_text = '';
$close_suffix = '';
$open_suffix = '';
if (strtotime(ActiveCycle::date_open_next()) < time() && strtotime(ActiveCycle::date_closed_next()) > time()) {
    $relative_text = 'Current&nbsp;';
} elseif (strtotime(ActiveCycle::date_closed_next()) > time()) {
    $relative_text = 'Next&nbsp;';
} else {
    $relative_text = 'Prior&nbsp;';
}
if (strtotime(ActiveCycle::date_open_next()) < time()) {
    $open_suffix = 'ed';
Пример #4
0
function renew_membership($member_id, $membership_type_id)
{
    global $connection;
    // First see if the member can sign up for this particular membership_type
    $membership_info = get_membership_info($member_id);
    $renewal_info = check_membership_renewal($membership_info);
    // Compare the member's current membership_type to what they have requested
    if (!in_array($membership_type_id, explode(',', $membership_info['may_convert_to']))) {
        // Requested membership_type is not allowed for this membership_type
        return 'Requested membership_type is not allowed.';
    }
    // Check if this member can renew at the requested membership_type
    $query_membership_type = '
      SELECT
        *
      FROM
        ' . TABLE_MEMBERSHIP_TYPES . '
      WHERE (
        enabled_type = "2"
          OR enabled_type = "3")
        AND FIND_IN_SET(membership_type_id,"' . $membership_info['may_convert_to'] . '")';
    $result_membership_type = mysql_query($query_membership_type, $connection) or die(debug_print("ERROR: 683080 ", array($query_membership_type, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if (!($row_membership_type = mysql_fetch_array($result_membership_type))) {
        // Requested membership_type is not allowed
        return 'Requested membership_type is not allowed.';
    }
    // Everything is good to here... so prepare to post the membership.
    //    When switching membership types, we will use the suggested_renewal_date for the
    //    new membership_renewal_date. When keeping the same membership type, we will
    //    use the standard_renewal_date.
    if ($renewal_info['membership_expired'] == false && $renewal_info['membership_type_id'] == $row_membership_type['membership_type_id']) {
        $renewal_date = $renewal_info['standard_renewal_date'];
    } elseif ($renewal_info['suggested_renewal_date'] != '') {
        $renewal_date = $renewal_info['suggested_renewal_date'];
    } else {
        $renewal_date = date('Y-m-d', time());
    }
    // If this is a renewal, then we use the renewal costs but if it
    // is a switch to a different type, then we use the initial cost
    if ($membership_info['membership_type_id'] == $membership_type_id) {
        // Renewal
        $target_field = 'renew_cost';
    } else {
        // Switch type
        $target_field = 'initial_cost';
    }
    // Post the membership receivable
    $transaction_row = add_to_ledger(array('transaction_group_id' => '', 'source_type' => 'member', 'source_key' => $member_id, 'target_type' => 'internal', 'target_key' => 'membership_dues', 'amount' => $row_membership_type[$target_field], 'text_key' => 'membership dues', 'posted_by' => $_SESSION['member_id']));
    // Now update the members table
    $query_members = '
      UPDATE
        ' . TABLE_MEMBER . '
      SET
        last_renewal_date = "' . mysql_real_escape_string($renewal_date) . '",
        membership_type_id = "' . mysql_real_escape_string($membership_type_id) . '"
      WHERE
        member_id = "' . mysql_real_escape_string($member_id) . '"';
    $result_members = mysql_query($query_members, $connection) or die(debug_print("ERROR: 683080 ", array($query_members, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if (mysql_affected_rows()) {
        return 'Successfully updated membership.';
    }
}