//JFB Connect Action Check Code
$couponUrl = 'http://www.mysite.com' . $this->item->link;
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/models');
$jfbcOgActionModel = JModelLegacy::getInstance('OpenGraphAction', 'JFBConnectModel');
$urlKey = $jfbcOgActionModel->getUniqueKey($couponUrl); // The URL of the object page
$action = $jfbcOgActionModel->getAction('1'); // ID of the action you want to check
// Check to see if the user has disabled the action (if the action is configured to be disable-able) and check if it hasn't been triggered within the timeframe settings
if ($action->enabledForUser()) {
$isReady = true;
} else {
$isReady = false;
}
if($isReady == false){ ?>
alert("Item Already Used");
// ITEM USED DIV HERE IN RED
if($isReady == true){
echo($urlKey);
// MY NORMAL ITEMS HEREif ($action->actionReady($urlKey) && $action->enabledForUser()) {
$isReady = true;
} else {
$isReady = false;
}
if($isReady == false){ ?>
alert("Item Already Used");
RED ITEM USED
if($isReady == true){
echo($urlKey); //this prints if true... which it always is... so I get 5 of them back each time
$query = "SELECT COUNT(*) FROM #__opengraph_activity WHERE
`action_id` = " . $this->id . " AND
`user_id` = " . $userId . " AND
`unique_key` = " . $this->db->quote($uniqueKey) . " AND
`status` = 1 AND
(`created` > (NOW() - " . $duration . ") OR " . $this->params->get('og_unique_action') . ")";
$this->db->setQuery($query); $action = $jfbcOgActionModel->getAction('1'); // ID of the action you want to check
print_r($action);Join our newsletter to get alerts for Joomla releases, tips and tricks and extension updates.
