I am using the following conditional in my form for an Edit and Delete link to display for an author of a post. I need to change it so that anyone who is an editor or administrator can view the links. Any help appreciated.
[wpv-conditional if="('[wpv-current-user info='id']' eq '[wpv-post-author format='meta' meta='ID']')"]
[toolset-edit-post-link content_template_slug="edit-listing"]Edit Listing[/toolset-edit-post-link] | [cred_delete_post_link class='cred-refresh-after-delete' text='Remove Listing' message='Are you sure you want to remove this listing?' message_after='Poof! Listing Removed. We moved it to the trash for safekeeping' message_show='0' action='trash' redirect='455']
[/wpv-conditional]
Hello. Thank you for contacting the Toolset support.
Well - I would like to know here you want to keep the author condition or you want to replace the current condition with editor or administrator?
If you want to change the condition so that the edit link should be visible to editor or administrator.
You can use the access shortcode:
[toolset_access role="Editor,Administrator" operator="allow"]
[toolset-edit-post-link content_template_slug="edit-listing"]Edit Listing[/toolset-edit-post-link] | [cred_delete_post_link class='cred-refresh-after-delete' text='Remove Listing' message='Are you sure you want to remove this listing?' message_after='Poof! Listing Removed. We moved it to the trash for safekeeping' message_show='0' action='trash' redirect='455']
[/toolset_access]
Have you installed the access plugin? This shortocde belongs to Toolset access plugin.
Or
If you do not want to use the Toolset access plugin. You can use the following code:
[wpv–conditional if="( '[wpv-current-user info='role']' eq 'administrator' ) OR ( '[wpv-current-user info='role']' eq 'editor' )"]
[toolset-edit-post-link content_template_slug="edit-listing"]Edit Listing[/toolset-edit-post-link] | [cred_delete_post_link class='cred-refresh-after-delete' text='Remove Listing' message='Are you sure you want to remove this listing?' message_after='Poof! Listing Removed. We moved it to the trash for safekeeping' message_show='0' action='trash' redirect='455']
[/wpv–conditional]
Unfortunately, I did not install the access plugin. But, when I replace the code you gave me with the [wpv-conditional ....] shortcode, the shortcode displays on the frontend.
I am using the latest version of the Divi theme without the new Divi Builder experience. 🙂
Can you please share problem URL and access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I've added the conditional shortcode as given under:
{!{wpv-conditional if="( '{!{wpv-current-user info='role'}!}' eq 'administrator' ) OR ( '{!{wpv-current-user info='role'}!}' eq 'editor' )" }!}
[toolset-edit-post-link content_template_slug="edit-listing"]Edit Listing[/toolset-edit-post-link] | [cred_delete_post_link class='cred-refresh-after-delete' text='Remove Listing' message='Are you sure you want to remove this listing?' message_after='Poof! Listing Removed. We moved it to the trash for safekeeping' message_show='0' action='trash' redirect='455']
{!{/wpv-conditional}!}
One more question. When deleting a listing, it goes to the trash. Can display the trashed listings on the frontend? Or, when deleting a listing, can it be marked as archived and removed from the listings view and display in a view that only shows archived listings?