Skip Navigation

[Resolved] Edit a form submitted content from FrontEnd

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)

Author
Posts
#2548327

Tell us what you are trying to do?
I'm building a directory, where each member will fill a form with their own information to be featured on the directory.
What I need is to have the option for the member to edit their info without having to give them access to backend.
I followed tutorials, but was not able to make it work.
I think that it's because we are using Divi Builder to create the website.
Could you please help me solve this issue?

Is there any documentation that you are following?
https://toolset.com/lesson-placement/lesson-placements-1621521-1612095/

Is there a similar example that we can see?
no

What is the link to your site?
hidden link

#2548577

Waqar
Supporter

Languages: English (English )

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

Hi,

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

To suggest the best way to achieve this, I'll need to see exactly how this form and the page where you'd like to show it are set up.

Can you please share temporary admin login details, along with the link to the page with this edit form?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2549349

Waqar
Supporter

Languages: English (English )

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

Thanks for writing back.

The password that you shared is not getting accepted for the username.

Can you please check the username and password again?

I'm setting your next reply as private.

#2551123

Waqar
Supporter

Languages: English (English )

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

Thank you for sharing the access details.

Here are the steps, that I'll recommend:

1. You can register a custom shortcode, that returns the ID of a 'DOTM submissions' post, if the current user has created one, as an author:


add_shortcode( 'current_user_sub_id', 'current_user_sub_id_func');
function current_user_sub_id_func()
{
	$current_user_id = get_current_user_id();

	if($current_user_id > 0) {
		$args = array(
			'posts_per_page'	=> 1,
			'post_type'			=> 'dotm-submissions',
			'post_status'		=> 'publish',
			'author'			=> $current_user_id,
		);
		$posts_array = get_posts( $args );

		if($posts_array) {
			$target_post_id = $posts_array[0]->ID;
		} else {
			$target_post_id = 0;
		}
	} else {
		$target_post_id = 0;
	}

	
	return $target_post_id;
}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.

This shortcode will return the current user's 'DOTM submissions' post ID if it exists and if not or if the user is not logged in, it will return '0'.

2. Next, please add "current_user_sub_id" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.

3. On the page, where you'd like to show the edit form 'Edit DOTM form', you can call it through the form's shortcode, like this:
( ref: https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_form )


[cred_form form="Edit DOTM form" post="[current_user_sub_id]"]

As a result, the edit form will load with the current user's 'DOTM submissions' post selected for editing.

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

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