Skip Navigation

[Resolved] How to Edit User profile

This support ticket is created 3 years, 6 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.

Our next available supporter will start replying to tickets in about 8.84 hours from now. Thank you for your understanding.

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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 3 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2051041

Waqar alredy help me with that problem:

Now, that the form to add a new profile (Projektanti) is ready, the next step is to create a form that can be used to edit the existing profile (Projektanti).

1. Please go to WP Admin -> Toolset -> Post Forms and clone the form "Form for Projektanti".
( screenshot: hidden link )

You can name the new copy of the form something like "Form for editing Projektanti".

2. Next, open the edit screen of the newly created form "Form for editing Projektanti" and change its type from "Add new content" to "Edit existing content".
( screenshot: hidden link )

3. You'll also need a custom shortcode, that can get the current user's existing profile (Projektanti) post ID and used it with the newly created edit form:

add_shortcode('current_user_profile_edit_form', 'current_user_profile_edit_form_fn');
function current_user_profile_edit_form_fn( $atts ) {

$a = shortcode_atts( array(
'type' => '',
'form' => ''
), $atts );

$user_post = get_posts( array(
'post_type' => $a['type'],
'author' => get_current_user_id(),
'numberposts' => 1
) );

if(!empty($user_post)) {
$target_post = $user_post[0]->ID;
ob_start();
echo do_shortcode('[cred_form form="'.$a['form'].'" post="'.$target_post.'"]');
return ob_get_clean();
}

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

4. Lastly, you'll place, this shortcode inside the conditional check on your "Moj profil" page, just below the existing code for the add a new profile form:
( screenshot: hidden link )

{!{wpv-conditional if=" ( ( '[current_user_post_count type='projektanti']' ne '0' ) ) " }!}
{!{current_user_profile_edit_form type="projektanti" form="form-for-editing-projektanti"}!}
{!{/wpv-conditional}!}
As a result, a user who has not created a profile (Projektanti), will see the form to add a new profile (Projektanti). And the user who has already created a profile (Projektanti), will see the form to edit it.

Note: I'll reply to your question about the lightbox gallery, in a separate ticket.
( ref: https://toolset.com/forums/topic/split-how-to-create-lithebox-gallery/ )

regards,
Waqar

My new problem:
I need one more time help from you. I create new user (Izvodac) and everything the same but I canot get form for edit post (First form to create post - works) but on my profil page I canot get form for editing that post ("profil").

Pleas can you inspect?

#2051395

Hello,

Please follow our document to setup the edit post form:
https://toolset.com/course-lesson/front-end-forms-for-editing-content/

I assume you are using a view block to list current logged-in user's posts, you can display the edit post link in loop of view block, see above document section "Adding an edit link to a list of items":
https://toolset.com/course-lesson/front-end-forms-for-editing-content/#adding-an-edit-link-to-a-list-of-items