Jacco van der Post
Jacco van der Post

Reputation: 618

TYPO3 get usergroups with typoscript

I am trying to get the usergroup titles which belong to the current fe_user. I have this script as an example, but it returns me all the usergroups.

If I only implement the first 3 lines, the correct usergroup uid comes out. What should be changed?

    30 = TEXT
    30.data = TSFE:fe_user|user|usergroup
    30.required = 1
    30.split {
        token = ,
        cObjNum = 1 || 2
        1 {
            10 = CONTENT
            10.table = fe_groups
            10.select.pidInList = 25
            10.select.andWhere.current = 1
            10.select.andWhere.wrap = uid=|
            10.renderObj = TEXT
            10.renderObj.field = title
            10.renderObj.wrap = |,
        }
        2 < .1
        2.10.renderObj.wrap >
    }

Upvotes: 0

Views: 585

Answers (1)

Jacco van der Post
Jacco van der Post

Reputation: 618

Ok I found it, the problem was andWhere, it should be where.

    30 = TEXT
    30 {
        data = TSFE:fe_user|user|usergroup
        required = 1
        split {
            token = ,
            cObjNum = 1

            1.10 = CONTENT
            1.10 {
                table = fe_groups
                select {
                    pidInList = {$pages.frontEndUsers}
                    where.current = 1
                    where.wrap = uid=|
                }
                renderObj = TEXT
                renderObj.field = title
                renderObj.wrap = |,
            }
        }
    }

Upvotes: 1

Related Questions