Skip Navigation

[Resolved] How to use add / edit form for custom post type for custom user role

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 13 replies, has 2 voices.

Last updated by ricoF 1 year, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2613015

Hi team,

i have a custom user role named "organizer" wich can add and edit own events. "events" is a custom post type. I've also add different sites to list the events and include the form etc.

In WordPress i add a page "my events" wich includes a list [wpv-view name="events"] wich works.
There is a child page "add / edit event" with two forms. With the first one users can add a new event. Fine.

Now i want to link in my list [wpv-view name="events"] to the page "add / edit event" to edit with a second form a special event from my loop.
I've test it with [cred-link-form form="208" post="[wpv-post-id]" text="Edit"] (208 is my edit form id) but it only show the event without a form.

Best
Rico

#2613275

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Here is a doc that shows how you can use edit post forms:
- https://toolset.com/course-lesson/front-end-forms-for-editing-content/

Can you please follow the above doc and check if that helps.

#2613345

I've check the docs in https://toolset.com/course-lesson/front-end-forms-for-editing-content/ but these are only for Gutenberg. So i can't see an example shortcode.
I use the editor in another pagebuilder. The editor is like the wordpress editor.

Another point: like i've said i have a normal page named "add / edit event" with a toolset form to edit a custom content. So i need a solution for this page without a "Content Template".

Best
Rico

#2613367

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL of that page where you want to display the form as well as problem URL where I can see the edit post link.

*** 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.

#2615043

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I would like to know that do you want to edit the post or repeating field group item?

You can not club both edit post and repeating field group item into one form. Repeating field group item is also treated as separate post.

Can you please clarify you want to edit post or repeating field group item and direct link on frontend where I can see the form?

#2615369

Yes, i know that the repeating field group is a own post type and i need a separate form. That's why i have two forms for my event:
One form to add and edit a event (it's like an event topic) and one form to add and edit the dates for this event.
For example you have an event named "Seminars in Robotic For Beginners and Experts" with title, description images ...
And than you have two dates for beginners with a date range, a title. a maximal number of attendees etc. And three dates for experts and one for additional user and so on (this are my repeating field group).

In this page should be a list of all events by user: hidden link (View 210)
In this page should be the form to add and edit the event: hidden link (Form 200 and 209)
And in this can be the form to add and edit the dates: hidden link (Form 198 and 208)

#2615401

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share a test user (frontend user) for which I can see few events added and I can see those events on frontend on the following page:
=> hidden link

Currently I can see no events on the above page. Can you please share user/pass that I can use as frontend user where to that user few events are assigned.

#2615427

If i add the credentials here, every user can see it. Do you have an email? Or you add a new user in the backend for yourself.

Use hidden link for login.

After that you find an event in hidden link
With the Button "Neue Veranstaltungsreihe" you can add a new event. With "Bearbeiten" you can edit this event in a fancybox (but it would be better to show a new page. But this problem i descriped in my first ticket post).

Short problem description: currently it's not possible
- to edit the event in a new page
- to edit the dates (repeating field group)
- to add a new date (repeating field group)
It should be possible for example via a shortcode wich get the datas via URL.

#2615435

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok you can share frontend user access details here.

I have set the next reply to private which means only you and I have access to it.

#2615769

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To know we want to add new post or edit exiting one, I've adjusted the URL as given under within the following view:
=> hidden link

<a href="/meine-veranstaltungen/veranstaltungsreihe-bearbeiten-erstellen/?post_id=[wpv-post-id]"  title="[wpml-string]Bearbeiten[/wpml-string]: [wpv-post-title output='sanitize']" class="btn btn-sm btn-light">[wpml-string]Bearbeiten[/wpml-string]</a>

The above link will help user to redirect to the specified page:
=> /meine-veranstaltungen/veranstaltungsreihe-bearbeiten-erstellen/?post_id=[wpv-post-id]

Where as you can see we are passing the post ID dynamically.

Now, With the following page:
=> hidden link

I've added the form to display conditionally as given under to know if there is URL param post_id is not empty then we have to display the edit form otherwise the add form:

[wpv-conditional if="( '[wpv-search-term param='post_id']' eq '' )"]
[cred_form form="198"]
[/wpv-conditional]

[wpv-conditional if="( '[wpv-search-term param='post_id']' ne '' )"]
[cred_form form="208" post="[wpv-search-term param='post_id']"]
[/wpv-conditional]

Now if you can check on frontend: hidden link

If you click on button "Neue Veranstaltungsreihe" it will offer you add form and if you click on "Bearbeiten" link it will offer you the edit form.

Now, can you please tell me on what page you want to add/edit the repeating field group - have you created different page to add/edit repeating field group?

#2616341

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please confirm the solution I shared help you to resolve your issue.

#2616397

Thank you for your explanation.
The

?post_id=[wpv-post-id]

as an link parameter and the conditional statement helped.

Now I would also like to make it possible to add and edit repeating field group for an event.
With the parameter and the conditional function i've created a link to a view. And this view (299) prints a list with all repeating field groups belonging to my post. In these loop i can add my form to edit existsting dates. Is this the right way?

Maybe i'm testing later if i can loop the repeating fields directly in my event form. But i've read that it's not possible to have a form in a form, right?

I expected that if i have a CRED form the repeating fields are also included like in the backend.

#2616401

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Maybe i'm testing later if i can loop the repeating fields directly in my event form. But i've read that it's not possible to have a form in a form, right?
==>
Yes - that's correct.

As per our support policy, we entertain only one question per ticket and that is why I'm splitting this ticket as the original reported issue is resolved with this ticket. We will continue with the split ticket here:
=> https://toolset.com/forums/topic/split-how-to-use-add-edit-form-for-custom-post-type-for-custom-user-role-add-edit-form-for-repeating-field-group/

You are welcome to mark resolve this ticket.

#2616433

Thanks for the support. The other ticket i answer after the weekend.
My issue is resolved now. Thank you!