Skip Navigation

[Resolved] CPT not working properly

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 8 replies, has 2 voices.

Last updated by geoffD 4 years, 5 months ago.

Assisted by: Beda.

Author
Posts
#1374797

Hello

I have a CPT 'Person' and previously it has worked perfectly e.g.

When I go to the 'PERSON' page i.e. hidden link it refers to the layout 'template for people' and shows the information relating to that person.

or

When I want to delete a person, using this shortcode -

[toolset-edit-post-link layout_slug="people-remove-child"]Remove Child[/toolset-edit-post-link]

next to it in the view list it normally goes to the edit person page and deletes that person...

Now all that is happening when I try to perform any task relating to a PERSON I just get a 404 not found page...

I've tried resetting my permalink structure because at first although I had set the permalink to save as post title it was automatically generating an autocred name... resetting the permalink has stopped this but not solved the problem..

Please can you help..

Best regards

Geoff

#1374837

[toolset-edit-post-link layout_slug="people-remove-child"]Remove Child[/toolset-edit-post-link] is clearly not a delete function, as the ShortCode says it is a edit function, or better, a link to an Edit Form.

I know this because of "toolset-edit-post-link", this is a Toolset Forms ShortCode, used to link to edit posts with forms.
You can read more about this here https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/

To delete a post, instead, you would use the cred_delete_post_link shortcode, which can be inserted as well with the Forms GUI, it's called "Delete Post Link" and will produce something similar to below:

[cred_delete_post_link action='trash' message='Are you sure you want to delete this post?' message_show='1' class='cred-refresh-after-delete']Delete %TITLE%[/cred_delete_post_link]

The link you currently have is used to edit that post and will lead to it so to display the Edit Form in a layout (the layout people-remove-child).
It's not used to delete.
Now, eventually you had custom code in place that deletes the post when visited thru that link, but that would be very surprising because you could then never edit it.

That would however explain why you get a 404, since if the post is trashed or deleted you can not edit or view it either, and hence such link would lead to 404 - but in theory, the View would not even display the link if the post would not exist - so I really suspect you have some custom logic in place that is not part of Toolset.

Can you elaborate on this Aspect?

#1374855

Hi Beda

Thanks for your help with this....apologies the 'delete link' takes you to the edit page as you correctly say...but this is not the problem...Let's use the other example:

When I go to the 'PERSON' page i.e. hidden link it refers to the layout 'template for people' and shows the information relating to that person - but it goes to the 404 page....this happens with any person related functions, edit, delete, show ..it just can't find the CPT Person that has been created..

Many thanks

Geoff

#1374869

No, the Delete link will not take you to the Edit page.
The Edit Link will instead do that.

The Delete link will delete the post and redirect to where you set the ShortCode to, which of course, if the post was deleted or trashed, should not be that very post or its edit screen.

Instead when you'd call hidden link directly in a browser or link to it you'd see a Person Post called "bill Sykes"
Maybe you have a layout assigned to that but that won't show in the URL. It will only show as of how the post is styled.

However I cannot see hidden link, it's password protected
And even so it would not really help, because I still would not see the backend, which to me seems important here as I suspect you have a confusion related to Deleting, Editing and Viewing posts, and how to link/do this with the Toolset ShortCodes and Layouts.

I can set up an example, or control what you created and suggest adjustments, if you can provide me some details listed below:

1. The exact URL of the issue
2. What precisely needs to be done on that URL to see the issue
3. The precise link of the Backend where that Post is edited
==> If any Layout, View, Content Template or Toolset Form is used on the post and is of importance to the issue, please also link to the precise URL of those elements

I can then immediately see what is happening and wether or not it is expected, as well as suggest some solutions.

I have enabled a private reply so you can safely add login details.

Thanks!

#1374883

That should then be a permission issue due to Access settings or some other capability settings of the user.
The user you set up new is a "Member", while the user you set up for Minesh is most likely an Admin - otherwise I couldn't see all the options with that user in the WordPress Admin.

BTW, the username for the new user (Member) you provided is wrong, I found however the proper one in the WordPress Admin
When I logged in with that use I am redirected to a page that says hidden link
I can't see anything else with this user so it is clearly a permission issue.

I confirm that as Minesh I can edit, and delete (well, I did not delete because I am afraid to delete something I should not) on this page:
hidden link
Clicking leads to the proper locations/forms

However as the new user (Member) - while I can see that page and reach it - I cannot edit (it leads to a 404) and deleting likely will not work either (again, I did not try delete because afraid to delete something I shouldn't)

Those are all Toolset Forms Operations and therefore the first to check is if they are controlled correctly by Toolset Access here:
hidden link
There you can control who can do what with Post and User Forms.

Also note that on the Form hidden link - where you edit the actual Person it'll tell you thru a notice that this is an important step (to control it with Toolset Access).
The notice says:
Who can use this form?
Toolset Access provides additional controls about who can see and submit this form. You can offer this form only to specific roles and users, or open it for everyone.
To control who can see and use this form, go to the Access settings.

However, as I checked this, it seems to be done as expected!

Hence it could only be a permission issue on the page itself or post itself, which still does not explain why the DELETE action wouldn't work, as that is irrelevant to the page/post or even specific form permissions, instead a global permission for each user role for ALL forms at once.
But I understand actually DELETing works?

Hence my theory would be valid that some some permission on the Post Type person itself, is actually the cause.
The problem is, there is no such Post Type listed in Toolset Access Post Type control, however the Form does apply to a Post Type Person.

I noticed that it should be "People", so that is a Post Type that exists in Access as well, and Member have NO rights to see, edit, or else that Post type.

So this is the FIRST thing I would try:
Set the Member user role to at least be allowed to see the People Post Types, so that when you navigate to a single person you can actually see it and also, if a form is in it, hence display the form (that'll then depend on Toolset Access Forms settings)

I also see that every plugin on the Website is (heavily) outdated, so that is the second what I suggest to try: Update all software (on a staging site) and test again.
There where several Bugs resolved both in WordPress and Toolset (and also related to roles/permissions/forms).

If that would not resolve the issue, the next thing to try on a staging site is to disable all plugins but Toolset, to see if then the problem still happens (and also ensure that the Theme or some Custom Code is not causing it).

If all this still produces the same results, I fear I'll need a copy of the site, because then I will need to debug this locally and see what is happening - which cannot be done online as I'd have to run tools to debug and also remove/dissect the site to a degree that is not reasonable done online.

But I think - adding the reading permit to member for people posts will do the job.
Please let me know.

#1374885

Can I ask you something?
Is there any reason you did not migrate the relationships to the new format?
hidden link

Not that you have to, I am asking because the new feature is quite powerful and you use a lot of post types and relationships

Maybe it's because the relationships you use are not possible to migrate, this is perfectly possible and of course, a valid reason to not migrate.
However power users like you should have the opportunity to use the new features, so if you miss something with it, please let us know so we can look into it?

Thanks a Lot!

#1374889

Thank you for the feedback Beda

I will work through your notes and get back to you...

Sadly the one to one relationship didn't exist with Toolset when I started to develop the site so I used the WordPress relationship structure instead and used hooks to stop the user creating more that one of certain post types...Also Toolset doesn't connect relationships with the USER type and won't let you make conditional statements with a USER which caused a problem...

I was too far into the development to upgrade to the new version and I would have lost a lot of work...

I think when I have time I will re-develop the site using the new version of Toolset

Thanks again...much appreciated

Geoff

#1374891

I understand.

Regarding the issue you reported, start with "adding the reading permit to "member" roles for "people" post type".
I think that will solve it for now.

#1374909

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.