Skip Navigation

[Resolved] Cannot get edit button to show up on content template

This thread is resolved. Here is a description of the problem and solution.

Problem: I have an edit post Form in an unassigned Content Template. When I try to display a link to edit the post in my single post template, no link is displayed.

Solution: Check the post author to confirm it is set appropriately, and confirm the Form permissions settings per User Role in Toolset > Access Control, in the Toolset Forms tab.

Relevant Documentation: https://toolset.com/course-lesson/allow-users-to-manage-their-items/

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Author
Posts
#2040053

Tell us what you are trying to do? I would like to add an "edit this listing" link at the bottom of a template page.

Is there any documentation that you are following? https://toolset.com/course-lesson/allow-users-to-manage-their-items/ (last section), as follows:

Insert the Fields and text block.
Click the Add Form button and then click the Edit post link.
Select the Content Template you created for editing posts and click to insert the shortcode.

Is there a similar example that we can see?

What is the link to your site? It has been added to this template: hidden link

At the end of this page, I have added a link using those instructions, yet the link does not show up even when logged in.

You should be able to see the link on that template that says "Is this your listing? You may edit it by linking here."

Thanks.

#2040161

I'll be glad to take a closer look, but these credentials do not seem to be working. I have removed the credentials from the post and placed them in a private area for your security. It might be faster if I can log in using an admin account to see how this is set up in wp-admin. Can you provide admin logins in the private reply fields?

#2041617
Screen Shot 2021-05-03 at 3.28.09 PM.png

Okay thanks for the additional information. When I log in as the admin User, I see a link to edit the post in this page:
hidden link
I'm attaching a screenshot showing what I see as admin. When I click the link "Is this your listing? You may edit it by linking here." I am redirected to the template containing the edit Mentor Form:
hidden link

So the link appears to be implemented correctly, but there is a permissions issue. I am not able to log in as MaxineTester given the password you provided yesterday, so I'm not able to see the problem on the live site. However, I was able to turn on the Author field for Mentor posts in Toolset > Post Types, and it seems that MaxineTester is not the author of any Mentor posts. An admin is the author of the Maxine the Mentor post, not the MaxineTester User. So it doesn't surprise me that you are unable to edit the Maxine the Mentor post when logged in as Maxine, given the permissions settings in Toolset > Access Control > Post Forms. MaxineTester is a Subscriber User, and Subscribers do not have permission to edit others' posts using the Edit Mentor Form.

How would you like to proceed here? Should the Access permissions settings be changed, or should we be testing with a post that is actually authored by the MaxineTester User? If it's the latter, please set up that Mentor post and let me know so I can continue investigating. I assume you'll need to log in as MaxineTester and submit a Form to create a new Mentor post.

#2041631
author list.png

thanks Christian.

That's so odd about Maxine's listing (obviously a bogus one I made up!) I have used her username to test different parts of the site and they have worked before. This time I used her login and set up the Maxine Mentor listing - and you're right - I see now that somehow I (as an Admin) ended up being the author.

So just now I tried logging in with another of my test users (Banjo the Dog) - and I can see the Edit button with his listing. So - it does work!

The question is - is it possible to change the Author of any given listing? I see now (sorry - I missed this when I reached out yesterday) - that the Author shows up in the main Mentors list. And all but Banjo were authored by the Admin (me.) But is there a way to create a listing and assign a different author? (I ask this because I have another directory, not made with Toolset, that does allow me to change the author, and it has been a convenient capability more than once.)

So - the original problem isn't a problem - and I thank you for your help in catching that.

But I still do have the question about changing a listing's author. If I try to do that from the admin edit page, I get only the Admins on the list (see attached) - not even the original author of the post and certainly none of the others. (In this case, I could have / would have changed the author from me, the Admin, to Maxine Mentor.)

#2042593

But is there a way to create a listing and assign a different author? (I ask this because I have another directory, not made with Toolset, that does allow me to change the author, and it has been a convenient capability more than once.)
You can expose the author field in the post editor for any custom post type created by Toolset Types by enabling the Author field in the post type editor. Go to Toolset > Post Types, edit the custom post type, and open the "Sections to display when editing" panel. You can enable the Author field here, and it should be available in the post editor screen for all posts in that post type. You may need to open the Screen Options tab at the top right corner to turn on the Author field once it's enabled. I can't say for sure how to expose the author field in the post editor for custom post types not created by Toolset Types. It depends on how that post type is registered by a 3rd-party system. If the author field is enabled programmatically when the post type is registered by that system, you should be able to see the author field in the post editor screen. Again, check the Screen Options tab in the top right corner to see if the field is available for editing. If the Author field is not shown in the Screen Options tab, that means the post type was not registered in a way that allows this option to be edited in the post editor screen. In that case, check with the support team for the plugin or theme that creates the post type and see if there is another way to enable the author field. Otherwise, a custom code solution or direct database manipulation is probably necessary to modify the author of an existing post. In the posts table, you can adjust the post_author to directly set the post author by User ID.

But I still do have the question about changing a listing's author. If I try to do that from the admin edit page, I get only the Admins on the list (see attached) - not even the original author of the post and certainly none of the others.
WordPress manages the author dropdown box options here, and I believe the options are limited by User role. You would need a custom code snippet to filter the options provided here. Depending on whether you use the Block Editor or the classic editor to edit this post, the custom code snippet is different. This post has a snippet that the poster claims will allow you to filter those options by User role in the Block Editor, but I can't guarantee it works in all cases as it's a custom code solution provided by a 3rd-party:
https://www.davidmillington.net/2020/02/25/wordpress-authors-dropdown-custom-roles/
It also claims to work with the Quick Edit feature.

The solution in another ticket provides a filter that we have found useful for filtering the options of the post author box when editing a post using the classic post editor: https://toolset.com/forums/topic/cant-add-new-user-with-new-custom-role-as-author/
This solution does not work with the Block Editor, though. If you use both editors to edit the same post type arbitrarily per post, you'll need a combination of both solutions to support both editors.

#2042595

My issue is resolved now. Thank you!