[TYPO3-english] Session check / Error when calling setKey() or getKey()

Benoit Montereau bmontereau at gmail.com
Tue Mar 20 00:14:00 CET 2012


The original check (agains multiple ratings) made with tx_ratings
extensions is either 100% open or based on IP address. Unfortunately, IP
check is a litle bit to strong: 2-3 users sharing the same Internet access
cannot rate the same item.

Therefore I would like to base my check on a session level.

So I tried to add some code to the class tx_ratings_ajax in protected
function updateRating() but I'm getting errors as soon as I try to call
either

$GLOBALS['TSFE']->fe_user->setKey('ses',"mysess", "myvalue");
or
$GLOBALS['TSFE']->fe_user->getKey('ses',"mysess");

Error is *Fatal error*: Call to a member function setKey() on a non-object
in...

I'm using Typo3 4.6.6, do I have to make something special/specific
(additional include?) in order to get these functions available in my
class/function?

Thanks a lot in advance for your help.
BM




protected function updateRating() {
$apiObj = t3lib_div::makeInstance('tx_ratings_api');
/* @var $apiObj tx_ratings_api */


More information about the TYPO3-english mailing list