Hi Marko,
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