Chris.08i
12-11-2015, 12:30 PM
Hello,
I'm trying to create an if dependent on posts per day - however I'm unable to implement it within the PHP.
I'm fairly new to coding, so I maybe missing the mark completely.
I've tried:
$vbphrase[posts_per_day]
$post[postsperday]
$postsperday
$vbulletin->userinfo['postsperday']
None of these seem to work.
I am trying to implement it into the vBShop plugin in the newpost_complete.php hook.
The code is as follows:
<?php
if ($vbulletin->userinfo['userid'] AND $vbulletin->options['dbtech_vbshop_enablepoints'])
{
foreach ((array)VBSHOP::$cache['currency'] as $currencyid => $currency)
{
// Shorthand
$var = 'per' . $type;
if (!$currency[$var])
{
continue;
}
// Update the points table
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . $currency['pointstable'] . "
SET " . $currency['pointscolumn'] . " = " . $currency['pointscolumn'] . " + '" . doubleval($currency[$var]) . "'
WHERE userid = " . $vbulletin->db->sql_prepare($vbulletin->userinfo['userid'])
);
$info = array(
'currencyid' => $currencyid,
'amount' => doubleval($currency[$var]),
);
switch ($var)
{
case 'perthread':
$info['threadid'] = $threadinfo['threadid'];
break;
case 'perreply':
$info['postid'] = $post['postid'];
break;
}
// init data manager
$dm =& VBSHOP::initDataManager('Transactionlog', $vbulletin, ERRTYPE_ARRAY);
$dm->set('userid', $vbulletin->userinfo['userid']);
$dm->set('recipient', $vbulletin->userinfo['userid']);
$dm->set('ipaddress', IPADDRESS);
$dm->set('action', $var);
$dm->set('info', $info);
$dm->save();
unset($dm);
}
}
?>
Any help would be appreciated.
Cheers,
Chris
I'm trying to create an if dependent on posts per day - however I'm unable to implement it within the PHP.
I'm fairly new to coding, so I maybe missing the mark completely.
I've tried:
$vbphrase[posts_per_day]
$post[postsperday]
$postsperday
$vbulletin->userinfo['postsperday']
None of these seem to work.
I am trying to implement it into the vBShop plugin in the newpost_complete.php hook.
The code is as follows:
<?php
if ($vbulletin->userinfo['userid'] AND $vbulletin->options['dbtech_vbshop_enablepoints'])
{
foreach ((array)VBSHOP::$cache['currency'] as $currencyid => $currency)
{
// Shorthand
$var = 'per' . $type;
if (!$currency[$var])
{
continue;
}
// Update the points table
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . $currency['pointstable'] . "
SET " . $currency['pointscolumn'] . " = " . $currency['pointscolumn'] . " + '" . doubleval($currency[$var]) . "'
WHERE userid = " . $vbulletin->db->sql_prepare($vbulletin->userinfo['userid'])
);
$info = array(
'currencyid' => $currencyid,
'amount' => doubleval($currency[$var]),
);
switch ($var)
{
case 'perthread':
$info['threadid'] = $threadinfo['threadid'];
break;
case 'perreply':
$info['postid'] = $post['postid'];
break;
}
// init data manager
$dm =& VBSHOP::initDataManager('Transactionlog', $vbulletin, ERRTYPE_ARRAY);
$dm->set('userid', $vbulletin->userinfo['userid']);
$dm->set('recipient', $vbulletin->userinfo['userid']);
$dm->set('ipaddress', IPADDRESS);
$dm->set('action', $var);
$dm->set('info', $info);
$dm->save();
unset($dm);
}
}
?>
Any help would be appreciated.
Cheers,
Chris