Paid subscriptions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Robert9
    Member
    • Oct 2001
    • 53

    Paid subscriptions

    If you set ab a paid subscription and try to add a subscription manually, the time period is probably not shown as you want. Instead the right period it only adds 60 seconds to the start-date for the end-date. This should be fixed in the next release of vb.

    Meanwhile i use this code to fix the things for me:

    1. Find in /admincp/subscriptions.php around line 472

    Code:
     
      print_table_header($vbphrase['add_user']);
      $subinfo = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "subscription 
      WHERE subscriptionid = " . $vbulletin->GPC['subscriptionid']);
    after this add

    Code:
    //
      $sub['dummy'] = unserialize($subinfo['cost']);
      foreach ($sub['dummy'] AS $i => $dummy2) {
       $m=0;$d=0;$y=0;$fix=0;
       if ($dummy2['units'] == 'D') {
        $d=$dummy2['length'];
       } elseif ($dummy2['units'] == 'W') {
        $d=$dummy2['length']*7;
       } elseif ($dummy2['units'] == 'M') {
        $m=$dummy2['length'];
       } elseif ($dummy2['units'] == 'Y') {
        $y=$dummy2['length'];
       } else {
        $fix = 60;
       }
      }
      $future= mktime(date("H"), date("i"), 0, date("m")+$m , date("d")+$d, date("Y")+$y);
      $future+=$fix;
    then find after this:

    Code:
    'expirydate' => TIMENOW
    and replace it with

    Code:
    'expirydate' => $future

    What it does?
    Take length and unit (day, week, month, year) from the subscription
    and calculate a date in future.


    Attention:
    I use only one period for every subscription. If you use more than one period for a subscription you should sort the periods on unit and length for your needs.

    Maybe someone could/would improve the code, im no programer.

widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...