Hello!
I have made a lot of searches on the forum and can't figure it out.
Is there a way to check if a variable contains a specific string of words?
Something like :
<cms if variable1 contains="Eric">Hi, Eric!</cms:if>
The way I want to use it is to allow sharing entries with other users in the backend.
I am using extended user roles, and created a "Extended role" dropdown variable.
There's some checkboxes with each users name on the entry page only visible to the super-admin. I want to make it so that if the users name is checked, he can access the edit page of this entry.
What I did (which was working fine until there's more than 1 user checked) is :
(the "vendeur" extended role is there because I want this rule to apply only if the user has the "Vendeur" extended role)
Like I said, it's working perfectly if there's only one "author". So the "k_user_title" comparaison with author works.
But when there's 2 users checked, "author" will become for example "John Doe|Jane Doe". So of course, the "if k_user_title" will always remain false. Even though the name is part of the "Author" array.
What I would like to achieve would be :
Any help would be greatly appreciated.
I have made a lot of searches on the forum and can't figure it out.
Is there a way to check if a variable contains a specific string of words?
Something like :
<cms if variable1 contains="Eric">Hi, Eric!</cms:if>
The way I want to use it is to allow sharing entries with other users in the backend.
I am using extended user roles, and created a "Extended role" dropdown variable.
There's some checkboxes with each users name on the entry page only visible to the super-admin. I want to make it so that if the users name is checked, he can access the edit page of this entry.
What I did (which was working fine until there's more than 1 user checked) is :
(the "vendeur" extended role is there because I want this rule to apply only if the user has the "Vendeur" extended role)
- Code: Select all
<cms:if (k_user_title != "<cms:show author/>") && (user_extended_role='Vendeur')>
<cms:abort>
Access denied.
</cms:abort>
Like I said, it's working perfectly if there's only one "author". So the "k_user_title" comparaison with author works.
But when there's 2 users checked, "author" will become for example "John Doe|Jane Doe". So of course, the "if k_user_title" will always remain false. Even though the name is part of the "Author" array.
What I would like to achieve would be :
- Code: Select all
<cms:if (k_user_title DOESN'T CONTAIN "<cms:show author/>") && (user_extended_role='Vendeur')>
<cms:abort>
Access denied.
</cms:abort>
Any help would be greatly appreciated.