Skip Navigation

[Resolved] Edit form link for specific post and specific user group

This support ticket is created 4 years, 3 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by leilaG 4 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1469699

How do I add a edit form link to update a specific post for only a specific user group?

#1470615

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

Can you please share temporary admin login details along with the information about the form and page where you'd like to place an edit link?

This way, I'll be in a better position to guide you with the next steps.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1472457

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing the admin access and further details.

To confirm if I've understood the requirement correctly, you'd like to have an edit link for each "Weekly Menus" post on the page "Update Weekly Menus".
( yourwebsite.com/biocity-team/update-weekly-menus/ )

When an edit link for any of those posts will be clicked, the user will be taken to the "Weekly menu form" page.
( yourwebsite.com/biocity-team/weekly-menu-form/ )

This page will show the edit form "Weekly Menu Edit Form", which will edit the post for which the edit link was clicked.

If my understanding is correct, you can follow these steps to achieve this:

1. To dynamically create a list of "Weekly Menus" posts with edit links on the "Update Weekly Menus" page, you can create a new post view for this post type.

In the loop of this new view, you can include the link to the page with the edit form ("Weekly menu form") and the current post's ID passed in a URL parameter "mid", for example:


<a href="[wpv-post-url item='19999']?mid=[wpv-post-id]">Edit: [wpv-post-title]</a>

Note: 19999 is the ID of the page "Weekly menu form".

The resulting link would look like this:
yourwebsite.com/biocity-team/weekly-menu-form/?mid=20021
( 20021 is the ID for the "Nottingham" Weekly Menus post )

2. The next step would be to insert the edit form on the "Weekly menu form" page so that it can use post ID passed through the URL parameter "mid".

You can get the value of this parameter through the "wpv-search-term" shortcode:
( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-search-term )


[wpv-search-term param='mid']

This value can then be used in the shortcode of the edit form like this:
( ref: https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#cred_form )


[cred_form form="weekly-menu-edit-form" post="[wpv-search-term param='mid']"]

As a result, when someone will visit this page through link "yourwebsite.com/biocity-team/weekly-menu-form/?mid=20021" the form will use the "Nottingham" post for editing.

I hope this helps and please let me know if you need any further assistance around this.

#1474857

Hi, thanks for the instructions, we have adding the link to a VIEW and added to the page - hidden link

But the edit links are going to the back-end edit form.

Unsure of what you mean by Step 2, where does this go [wpv-search-term param='mid']?

#1476147

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back and I apologize if the steps from my last message caused some confusion.

I've checked your current set up and it needs following adjustments:

1. View "Weekly menu":
( yourwebsite.com/wp-admin/admin.php?page=views-editor&view_id=18898 )

In the view's content template, "wpv-post-edit-link" shortcode is being used which is why it is taking to the post edit screen in the admin area.


[wpv-post-title]
[wpv-post-edit-link]

Please replace it with the content from the point #1 in my last message:
( screenshot: hidden link )


<a href="[wpv-post-url item='19999']?mid=[wpv-post-id]">Edit: [wpv-post-title]</a>

2. Page "Weekly menu form":
( yourwebsite.com/wp-admin/post.php?post=19999&action=edit )

In this page's content, the edit form's shortcode is being used, but without specifying which post to edit, through the "post" attribute:


[cred_form form='weekly-menu-edit-form']

Please include the shortcode [wpv-search-term param='mid'] as the value for the "post" attribute. It will get the ID from the URL parameter "mid" and tell the form to edit that post:
( screenshot: hidden link )


[cred_form form="weekly-menu-edit-form" post="[wpv-search-term param='mid']"]

I hope this makes it more clear and let me know how it goes.

#1481093

It's working perfectly Thank you!

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