Show
Ignore:
Timestamp:
03/06/11 19:13:48 (2 years ago)
Author:
Torben Brodt
Message:

users registering with twitter need to accept the rules

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • twitter/files/lib/system/event/listener/UserLoginTwitterListener.class.php

    r1305 r1321  
    3030                         
    3131                        // did agree with rules? 
    32                         case 'SessionFactory': 
     32                        default: 
    3333                                // didInit 
    34                                 $this->validateRuleAgree($eventObj->session); 
     34                                if($eventObj instanceof SessionFactory) $this->validateRuleAgree($eventObj->session); 
    3535                        break; 
    3636                 
     
    9696                 
    9797                // if the modul activate and the user is twitter user he must agree the rules after a change, and the user is not a guest. 
    98                 if ($session->getUser()->userID && TwitterUtil::hasTwitterUser($session->getUser()->userID)) { 
     98                if ($session->getUser()->userID && $session->getUser()->didSkipRulesTwitter) { 
    9999                        // select all packageids of the packages where the user is agree with the rules. 
    100100                        $packageIDs = $session->getVar('package_agrees'); 
     
    104104                                // we check the agreement, is the user agree with the rules, we put the package id in to the array and leave the event. 
    105105                                if (Ruleset::isUserAgree($session->getUser()->userID, PACKAGE_ID)) { 
    106                                         if (is_null($packageIDs) || !is_array($packageIDs))  
     106                                        if (is_null($packageIDs) || !is_array($packageIDs)) { 
    107107                                                $packageIDs = array(PACKAGE_ID); 
    108                                         else $packageIDs[] = PACKAGE_ID; 
    109                                                 $session->register('package_agrees', $packageIDs); 
     108                                        } else { 
     109                                                $packageIDs[] = PACKAGE_ID; 
     110                                        } 
     111                                        $session->register('package_agrees', $packageIDs); 
     112                                         
     113                                        $session->getUser()->getEditor()->update(null, null, null, null, array( 
     114                                                array( 
     115                                                        'optionID' => User::getUserOptionID('didSkipRulesTwitter'), 
     116                                                        'optionValue' => 0 
     117                                                ) 
     118                                        )); 
    110119                                        return; 
    111120                                }