コード例 #1
0
ファイル: membershipid.php プロジェクト: vstorm83/propertease
 /**
  * Run when a membership activated
  * @param PlanOsMembership $row
  */
 function onMembershipActive($row)
 {
     $db = JFactory::getDbo();
     if (!$row->membership_id) {
         if ($row->user_id) {
             $sql = 'SELECT MAX(membership_id) FROM #__osmembership_subscribers WHERE user_id=' . $row->user_id;
             $db->setQuery($sql);
             $membershipId = (int) $db->loadResult();
             if ($membershipId) {
                 $row->membership_id = $membershipId;
             }
         }
         if (!$row->membership_id) {
             $row->membership_id = OSMembershipHelper::getMembershipId();
         }
         $row->store();
     }
     return true;
 }