I am trying to: Allow a CPT submission's author to make edits to their submission.
Link to a page where the issue can be seen: hidden link
I expected to see: An edit button on the page that will appear conditionally if the author is logged in.
Instead, I got: Not there yet. Trying to follow the instructions on this page: https://toolset.com/documentation/user-guides/displaying-cred-editing-forms/
I've done the following:
1. Created the Edit Submission CRED Form
2. Created the Content Template with the Edit CRED Form shortcode
3. When I go to the single view ("Submission View") and try to add the field (see screenshot), I get an error message (see other screenshot).
So I am unable to insert the link on the single view that links to the "Edit Submission" form, as this message is not allowing any shortcode to be submitted. I definitely have create the Content Template with the Edit Submission Shortcode inserted as described in the documentation. Its just that I cannot insert the link.
2. Created the Content Template with the Edit CRED Form shortcode
Actually when you have Toolset Layouts active, you must create an unassigned Layout with the Edit Form shortcode. The Content Template isn't sufficient. Please try creating a Layout instead of a Content Template and let me know if you continue to have trouble.
I tried that too, same problem.
See screenshot.
Then try to go to this page: hidden link
and add the CRED Edit Form field. You'll see the error message.
A CRED / Form cell is best in the Layout. When you insert the shortcode in a Visual Editor cell, it seems to have trouble recognizing the Layout contains the Form. I have modified that in the Layout and added the edit post link in the View. Can you verify it's working more like expected?
Ok, thanks, it is now working but I am not able to get the conditional working properly yet.
The below is a modification to your code with the goal of the submitting user or admins being the only people that can see the
Edit %%POST_TITLE%% link
To do this I attempted to add a conditional so that only the submitting author or the admin can see the Edit %%POST_TITLE%% link, as described here: https://toolset.com/forums/topic/conditional-cred-edit-link-for-post-author-or-site-admin/
However, the conditional loads the text "Hola, it works...!!" for the submitting author but not the Edit %%POST_TITLE%% link
The conditional code does seem to do what is expected for the admin (sees text and edit link), and non-logged in users (see neither text nor edit link). What needs to change on the following code to accomplish goal stated above?
[wpv-conditional if="( '[wpv-current-user info="login"]' eq '[wpv-post-author format="meta" meta="user_login"]' ) OR ( '[wpv-current-user info="role"]' eq 'administrator' )"]
Hola, it works...!! [toolset-edit-post-link layout_slug="layout-template-for-submission-edits"]Edit %%POST_TITLE%%[/toolset-edit-post-link]
[/wpv-conditiona]
Feel free to login again to make any adjustments.
I intentionally left a copy of your Edit %%POST_TITLE%% code below the conditional unaltered as a reference until this is solved.
Thanks!!
Okay so the conditional part is working as expected, but the edit post link is not appearing. This could indicate a permissions configuration problem in Access. Please confirm the following settings:
- In Toolset > Access Control > Forms tab, the post author's User Role should have the permission to "Edit Own Custom Post with CRED 'Form Edit Submission Form'". Without this permission, the link to edit the post will not appear. Right now, only a few roles have this permission, so if the testing post author is not one of these roles that could be the problem.
- In the Toolset > Access Control > Post types tab, the post author's User Role should have the permission to "Edit Own" under the Submissions post type. Again, right now only a few roles have this permission.