CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Bug #39842

usergroup ends with comma after confirmation, so login doen't work

Added by Tobias Braumann 9 months ago. Updated 9 months ago.

Status:Resolved Start date:2012-08-15
Priority:Must have Due date:
Assignee:Federico Bernardin % Done:

100%

Category:Generic FE code Spent time: -
Target version:-
Branch: Tags:
Votes: 0

Description

I leave postUsergroup and preUsergroup in TS and plugin empty and set the usergroup by myself in the hook 'beforeInsertUser', but after confirmation there is a comma behind my usergroup id in the datebasefield in fe_users and the standard login doesn't work, when usergroup list ends with comma

I debug the code and I think the failure is at the beginning of this function in the second foreach

protected function updateConfirmedUser($user) {
        $groupsBeforeConfirmation = explode(',', $this->conf['preUsergroup']);
        $groupsAfterConfirmation = explode(',', $this->conf['postUsergroup']);
        $usergroup = explode(',', $user['usergroup']);
        $newUserGroup = array();
        debug($newUserGroup,'newUserGroup1');
         foreach ($usergroup as $group) {
            if (!in_array($group, $groupsBeforeConfirmation)) {
                $newUserGroup[] = $group;
            }
        }
        debug($newUserGroup,'newUserGroup2');
        foreach ($groupsAfterConfirmation as $group) {
            if (!in_array($group, $newUserGroup)) {
                $newUserGroup[] = $group;
            }
        }
        debug($newUserGroup,'newUserGroup3');
        $user['user_auth_code'] = '';
        $user['usergroup'] = implode(',', $newUserGroup);
        debug($user['usergroup'],'end') 
        ...

Debuginfo:

newUserGroup1
EMPTY!
newUserGroup2
0 1
newUserGroup3
0 1
1
end
1,

problem_39842.patch - Patch for problem (142.2 kB) Federico Bernardin, 2012-08-26 11:36

History

Updated by Federico Bernardin 9 months ago

  • Status changed from New to Needs Feedback
  • Assignee set to Tobias Braumann

Please make a debug of $this->conf['preUsergroup'] and $this->conf['postUsergroup'] at the top of updateConfirmedUser. and put in this post. Thx

Updated by Tobias Braumann 9 months ago

debug($this->conf['preUsergroup'])
debug
debug($this->conf['postUsergroup']);
debug

my little work around for this issue. i do it in this hook extendBeforeUpdateConfirmedUser


public function extendBeforeUpdateConfirmedUser(&$params, &$pObj) {

        $params['user']['usergroup'] = $this->clearEndingComma($params['user']['usergroup']);
}

private function clearEndingComma($str) {
        if(  strrpos($str,',') === strlen($str)-1 ) {
            return substr_replace($str, '', -1);
        }
        return $str;
}

Updated by Federico Bernardin 9 months ago

If $this->conf['preUsergroup'] and $this->conf['preUsergroup'] are empty you cannot set them in your ts, otherwise they wold be set.
Please put your hook code and ts configuration.

Updated by Federico Bernardin 9 months ago

  • File problem_39842.patch added
  • Category set to Generic FE code
  • Status changed from Needs Feedback to Resolved
  • Assignee changed from Tobias Braumann to Federico Bernardin
  • % Done changed from 0 to 100

Resolved problem with attached patch.

Also available in: Atom PDF