Hi, when I tried to add a user in subscriptions earlier I received
Fatal error: Unsupported operand types in /home/user/public_html/forum/includes/functions_subscriptions.php on line 50
Don't know whats causing it I have only added paypal reacuring
This is around line 50, anyone see the problem
PHP Code:
// ###################### Start getsubscriptionscache #######################
function cache_user_subscriptions()
{
global $DB_site, $subscriptioncache;
if (!is_array($subscriptioncache))
{
$subscriptioncache = array();
$subscriptions = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "subscription");
while ($subscription = $DB_site->fetch_array($subscriptions))
{
$subscriptioncache["$subscription[subscriptionid]"] = $subscription;
}
$DB_site->free_result($subscriptions);
}
}
function construct_payment($method, $cost, $currency, $subscriptionid, $title, $userid)
{
global $vboptions,$DB_site;
$item = $subscriptionid . '_' . $userinfo['userid'];
$currency = strtoupper($currency);
switch ($method)
{
case 'paypal':
$form['action'] = 'https://www.paypal.com/cgi-bin/webscr';
$form['method'] = 'post';
/// Add In For Reacuring Payments
$paypalextra = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "subscription AS subscription WHERE subscriptionid=$subscriptionid");
if($paypalextra[reoccur]==0){// It is one time
$form['hiddenfields'] = "
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\" />
<input type=\"hidden\" name=\"business\" value=\"$vboptions[ppemail]\" />
<input type=\"hidden\" name=\"item_name\" value=\"$title Subscription\" />
<input type=\"hidden\" name=\"item_number\" value=\"$item\" />
<input type=\"hidden\" name=\"amount\" value=\"$cost\" />
<input type=\"hidden\" name=\"currency_code\" value=\"$currency\" />
<input type=\"hidden\" name=\"no_shipping\" value=\"1\" />
<input type=\"hidden\" name=\"return\" value=\"$vboptions[bburl]\" />
<input type=\"hidden\" name=\"no_note\" value=\"1\" />";
}else{
$form['hiddenfields'] = "
<input type=\"hidden\" name=\"cmd\" value=\"_xclick-subscriptions\" />
<input type=\"hidden\" name=\"business\" value=\"$vboptions[ppemail]\" />
<input type=\"hidden\" name=\"item_name\" value=\"$title Subscription\" />
<input type=\"hidden\" name=\"item_number\" value=\"$item\" />
<input type=\"hidden\" name=\"currency_code\" value=\"$currency\" />
<input type=\"hidden\" name=\"ammount\" value=\"$cost\" />
<input type=\"hidden\" name=\"a3\" value=\"$cost\" />
<input type=\"hidden\" name=\"p3\" value=\"$paypalextra[length]\">
<input type=\"hidden\" name=\"t3\" value=\"$paypalextra[units]\">
<input type=\"hidden\" name=\"src\" value=\"1\">
<input type=\"hidden\" name=\"sra\" value=\"1\">
<input type=\"hidden\" name=\"no_shipping\" value=\"1\" />
<input type=\"hidden\" name=\"return\" value=\"$vboptions[bburl]\" />
<input type=\"hidden\" name=\"no_note\" value=\"1\" />";
}
break;
case 'nochex':
$form['action'] = 'https://www.nochex.com/nochex.dll/checkout';
$form['method'] = 'post';
$form['hiddenfields'] = "
<input type=\"hidden\" name=\"email\" value=\"$vboptions[ncxemail]\" />
<input type=\"hidden\" name=\"amount\" value=\"$cost\" />
<input type=\"hidden\" name=\"ordernumber\" value=\"$item\" />
<input type=\"hidden\" name=\"returnurl\" value=\"$vboptions[bburl]\" />";
break;
case 'authorize':
$form = construct_authorize_form($cost, $item, $currency);
break;
case 'worldpay':
$form['action'] = 'https://select.worldpay.com/wcc/purchase';
$form['method'] = 'post';
$form['hiddenfields'] = "
<input type=\"hidden\" name=\"desc\" value=\"$item\" />
<input type=\"hidden\" name=\"cost\" value=\"$cost\" />
<input type=\"hidden\" name=\"currency\" value=\"$currency\" />
<input type=\"hidden\" name=\"instId\" value=\"$vboptions[worldpay_instid]\">
<input type=\"hidden\" name=\"cartId\" value=\"$title Subscription\">";
break;
}
return $form;
}
function construct_subscription_currency($method, $currency, $cost, $sub)
{
global $_SUBSCRIPTIONS, $_CURRENCYSYMBOLS, $bbuserinfo;
$currencies = $_SUBSCRIPTIONS['curencies']["$method"];
OK, I have changed the file back to the original and it still gives the error:
Fatal error: Unsupported operand types in /home/user/public_html/forum/includes/functions_subscriptions.php on line 50
What is causing that error if its not that file
This file seems to be the problem:
admincp/subscriptions.php
PHP Code:
// ###################### Start status #######################
if ($_POST['do'] == 'status')
{
globalize($_POST, array('subscriptionlogid' => INT, 'subscriptionid' => INT, 'userid' => INT, 'status' => INT, 'regdate', 'expirydate', 'username' => STR_NOHTML));
require_once('./includes/functions_misc.php');
//$regdate = vbmktime(intval($regdate['hour']), intval($regdate['minute']), 0, intval($regdate['month']), intval($regdate['day']), intval($regdate['year']));
$expirydate = vbmktime(intval($expirydate['hour']), intval($expirydate['minute']), 0, intval($expirydate['month']), intval($expirydate['day']), intval($expirydate['year']));
if ($expirydate < 0)
{
print_stop_message('invalid_subscription_length');
}
if ($userid)
{ // already existing entry
if (!$status)
{
$DB_site->query("
UPDATE " . TABLE_PREFIX . "subscriptionlog
SET regdate = $regdate, expirydate = $expirydate
WHERE userid = $userid
AND subscriptionid = $subscriptionid
");
delete_user_subscription($subscriptionid, $userid);
}
else
{
build_user_subscription($subscriptionid, $userid, $regdate, $expirydate);
}
}
else
{
$userinfo = $DB_site->query_first("
SELECT userid
FROM " . TABLE_PREFIX . "user
WHERE username = '" . addslashes($username) . "'
");
if (!$userinfo['userid'])
{
print_stop_message('no_users_matched_your_query');
}
build_user_subscription($subscriptionid, $userinfo['userid'], $regdate, $expirydate);
}
define('CP_REDIRECT', "subscriptions.php?do=find&subscriptionid=$subscriptionid");
print_stop_message('saved_subscription_x_successfully', $sub['title']);
}
// ###################### Start status #######################
Around the above area can anyone see anything wrong
OK, fixed I have kept this line:
print_label_row($vbphrase['start_date'], '<span>' . vbdate($vboptions['dateformat'] . ' ' . $vboptions['timeformat'], $sub['regdate']) . '</span>');
and not merged this one over the top
print_time_row($vbphrase['start_date'], 'regdate', $sub['regdate']);