New to Stash and here is what I'm trying to accomplish. But so far, no such luck.
I have two templates - manage-social-media.html and .layout-account.html
Manage-social-media.html Here I am gathering all of my content to pass to the layout-account template. I am using Zoo Visitor, and I have a custom field for “Permissions” (cf_member_firm_permissions) that I’d like to check to see if they can edit their content, or view only. So the custom field (Fieldpack - Dropdown) looks like this:
... : Select One read-only : Read Only editor : Editor
What I want to do is test that variable to see what it is, then set some stash variables accordingly. Mainly, if they are read-only, I’d like to do the following:
Set Stash variable for: “Read Only Message” - To tell them why they are unable to edit, and who they can contact. Set Stash variable for: “Disalbe form” - I was thinking that I would just add the stash variable (i.e. “disable” to the form fields so they could read them but not edit. Any other suggestions?
So I got the value for {cf_member_firm_permissions} by doing the following:
{exp:zoo_visitor:details}
{cf_member_firm_permissions}
{/exp:zoo_visitor:details}
From there, I can’t get it to work. I’ve tried wrapping the above in a “stash”, wrapping the above around a “stash”, using a switchee statement to test the value of {cf_member_firm_permissions}, using a switchee statement to test the value of stash:user_permissions (after I’ve set it). I can’t get anything to do what I want.
Of course, all of the above is set within a stash variable “main_content” which is pulled into the layout template.
Here is some of the code that I've tried:
{exp:zoo_visitor:details}
{exp:switchee variable="{cf_member_firm_permissions}" parse="inward"}
{case value="read-only"}
<h3>Hello Reader Permissions</h3>
{exp:stash:set name="permissions"} disabled{/exp:stash:set}
{/case}
{case value="editor"}
<h3>Hello Editor Permissions</h3>
{/case}
{/exp:switchee}
{/exp:zoo_visitor:details}
It displays "Hello Reader Permissions", but won't display anything else.