Skip Navigation

[Resolved] Allowing users to edit their posts on a separate page built by elementor that has cred edit form

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

Problem:
Allowing users to edit their posts on a separate page built by elementor that has cred edit form

Solution:

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/allowing-users-to-edit-their-posts-on-a-separate-page-built-by-elementor/#post-2365713

Relevant Documentation:

This support ticket is created 2 years, 7 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
- 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 6 replies, has 4 voices.

Last updated by davelow 2 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2362495
Screenshot 2022-05-13 at 20.11.26.png
Screenshot 2022-05-13 at 20.09.42.png
Screenshot 2022-05-13 at 20.08.35.png
Screenshot 2022-05-13 at 20.07.46.png
Screenshot 2022-05-13 at 20.07.02.png

Tell us what you are trying to do?

The posts currently use a toolset template which conditionally provide logged in users to edit posts they authored. the edits include updating the relationships of the posts. see example: hidden link

Am attempting to design the same page using elementor. I understand from the support forum that in doing this I have to make users to edit their posts on a separate page.

I have followed the examples in the posts below but unable to achieve the desired result.

I think the post edit form side is ok, probably the link that I have inserted in the template which i have trouble.
I have tried using the following elementor widgets to establish the link
A) Button element with custom link
B) HTML
C) Text Editor

I may have missed something or these solutions have become obsolete. Please advise. Much thanks for your time.

Is there any documentation that you are following?

https://toolset.com/forums/topic/edit-form-with-elementor/
https://toolset.com/forums/topic/editing-an-elementor-template/

Is there a similar example that we can see?

the following requires login, I'll be happy to provide credentials in a private reply.

hidden link (current toolset template)
hidden link (new elementor template)

What is the link to your site?

#2362703

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

The normal edit post workflow involves creating an edit form (which has to live inside an unassigned template, because reasons), and then adding a link to the edit form (actually to the template containing it) either to the output of a View listing such posts, or to the content template used to display such posts.

So, if I have a post type "Things" and I have a Content Template to specify the output of Thing posts displayed on the front end, I add an edit link to that template. When clicking said link the normal post url loads (e.g. site.com/thing/something/) except it has a URL parameter which tells Toolset not to load the normal post content but to switch and display the content of the unassigned template containing the edit form instead (where the context of which post to edit is determined by the current post url).

The problem when introducing Elementor into this, where you use an Elementor template for the post type instead of a Toolset Content Template, is that Toolset templates only replace the content part of the screen (literally where the post content—or post body—is output). So the Elementor template must output the post content (i.e. must include a post content module), and only that part of the page will be replaced by the edit form. Whatever else you are outputting with the Elementor template will still be displayed.

If that doesn't matter then there's no problem, you just need to follow the above workflow (see the lesson https://toolset.com/course-lesson/front-end-forms-for-editing-content/).

If it does matter there are two alternatives.

If your Elementor template layout is fairly straightforward (for example, the post content is displayed alone in the first row, and other content appears afterwards) then you could add some custom CSS to the edit form, so that when the edit link is followed and the edit form loaded, it hides the rest of the content from the Elementor template.

An alternative is to use a different workflow, whereby you don't edit posts at their own url, and instead you add the edit form to a static page. When you load the page the edit form doesn't know which post it should be editing, so you need to tell it.

You do that by creating links to that page which pass the ID of the post you want to edit using a URL parameter (which you can call whatever you want).

So in your template for the posts where you want the edit link to appear, append the id to the link with the wpv-post-id shortcode, e.g.

<a href="<em><u>hidden link</u></em>;">Edit [wpv-post-title]</a>

Then on the page that contains the edit form, use a shortcode to insert the form (not a block), so that you can use the wpv-search-term shortcode to tell the form to listen to the editID parameter to get the id of the post to edit, e.g.

[cred_form form="edit-thing" post="[wpv-search-term param='editID']"]

There's quite a bit to digest there, but hopefully if you try it it will make sense.

#2364823

Hi Nigel,

Thank you for the explanation, and it helps me understand the concepts of the normal and alternate workflow.

Specifically I had went for the 2nd alternative, where I employed a separate page to contain the edit form.
On this page I have the shortcode (inserted using shortcode block) as follows:
[cred_form form='edit-dog' post='[wpv-search-term param="dog"]']

on the template for posts, i had tried various ways to convey the post-id but cannot seem to get it across.
I have tried the following widgets:
1. Button (with link hidden link;
2. HTML (hidden link;">Edit [wpv-post-title]
3. Text Editor (hidden link;">Edit [wpv-post-title]

Can you help to see which part i have gotten it wrong?

Many thanks,
Dave

#2365017

Minesh
Supporter

Languages: English (English )

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

At first look all three options you shared looks correct to me and I will require to check where exactly it fails.

Can you please share problem URL and admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) 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.

#2365713

Minesh
Supporter

Languages: English (English )

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

I've created the following content template and added the following Edit links to it:
=> hidden link

==========================================
From Toolset Content Template
==========================================
<a href="<em><u>hidden link</u></em>;">Edit [wpv-post-title]</a>

<a href="<em><u>hidden link</u></em>;">Edit [wpv-post-title]</a> html doesnt work

I've changed the URL param to dog_id. I've added the above content template using the shortcode module to your elementor template:
=> hidden link

[wpv-post-body view_template="container-for-edit-form-link"]

On your edit dot page where you added the edit form, I've added the form as given under:
=> hidden link

[cred_form form='edit-dog-form' post="[wpv-search-term param='dog_id']"]

Also, I've changed the edit form slug from "edit-dog" to "edit-dog-form" as we will require to use the unique slugs:
=> hidden link

Now, when you click on the links I've added at the bottom of the page using content template:
=> hidden link

I can see its working as expected.

#2366255

Hi there,

I hope I read this right and you're looking to show edit links on the Single CPT pages via elementor.

I create all my websites using toolset and elementor now and it works a real treat for me!

I don't use content templates unless adding taxonomy images onto archive pages.

I have a solution that worked for me;

Take a look at my solution here;
https://toolset.com/forums/topic/edit-content-link-in-elementor-not-working/page/2/#post-1648443

Basically, without going into too much detail;

Create the link like;

<a href=" yoursite.......com  /  edit-dog-form-page  /  ?partner_id=[wpv-post-id]" target="_blank">Edit Dog Form</a>

The dots and spaces are to stop toolset.com making it a 'Hidden Link'

Here you would change the "edit-dog-form-page" to the slug of the page your form has been insered into.

If you would like to open in a new tab keep the 'target="_blank"', or the other way is to remove the 'target="_blank"' and have the form redirect the the post page.

You would need to enter this snippet into your functions.php or into toolset's custom code area within the settings menu;

function func_edit_dog_form() {
   if(isset($_GET['partner_id'])){
     return do_shortcode("[cred_form form='edit-dog-form' post='".$_GET['partner_id']."']");
   }else{
     return "Please go back and click an edit dog form link";
   }
}
add_shortcode('display_edit_dog_form', 'func_edit_dog_form'); 

Here you would change the

cred_form form='edit-dog-form'

to your CRED form's slug.

If you need to create edit links for multiple CPTs you would edit the;

function func_edit_dog_form() {

to

function func_edit_whatever_you_want_here_form() {

AND

add_shortcode('display_edit_whatever_you_want_here_form', 'func_edit_whatever_you_want_here_form'); 

Activate the code within the settings area.

Duplicating the form, but not changing the above values with result in a site error, so I always test the site after entering custom code in a new tab, which allows me to edit the code within the snippets area, bringing the site back up, should there be any errors.

Create your new 'Edit Dog Form' page and add the form using a shortcode field, entering;

[display_edit_dog_form]

The "display_edit_dog_form" words within the shortcode, come from the snippet we created earlier.

This should do the trick.

The code within the snippet area takes care of the rest.

Within the post that I linked, further through, you can read about how to show the link to only the post author.

What I did here was just that, but also create another link using elementor's visibility controls, and assigning that link to admins only.

This way, admins had a link and the post author also had their own link on the respective pages, where as page guests had 0 links.

This could also be used in conjuction with;

https://toolset.com/forums/topic/conditional-display-based-on-url-parameter/

I really hope this helps.

I work with elementor and toolset every day now and have been doing for approx. 2 years, please hit me up if you would like any more help.

Take Care
Steve

#2366353

Hi Minesh,

Thank you for your time looking into this.
I see that a unique slug is important for operations like this.
My earlier assumption was that common slugs are acceptable if they belong to different entities (e.g. page, form, post-type etc etc)

In this case, changing 'dog' to 'dog_id' resolved the issue.
Use Text Editor to create the link.
Buttons and html widgets of Elementor cannot seem to pass the parameter successfully.

Thanks also to Steve for your insights! had a look at some of your production sites. beautifully and functionally built!

My issue is resolved now. Thank you!