Sauter la navigation

[Résolu] I need to insert the Form edit link to menu

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
I need to insert the Form edit link to menu

Solution:
If you want to set post form to edit specific post - Toolset form offer attribute "post" to which you can assign the post-Id.

For example:

[cred_form form='aggiungi-foto' post="999"]

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/i-need-to-insert-the-form-edit-link-to-menu/#post-1180082

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_form
=> https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/

This support ticket is created Il y a 6 années. 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)

Marqué : 

Ce sujet contient 12 réponses, a 2 voix.

Dernière mise à jour par francescoG-3 Il y a 6 années.

Assisté par: Minesh.

Auteur
Publications
#1179075

Tell us what you are trying to do? I need to insert the Form edit link to menu

Is there any documentation that you are following? No

Is there a similar example that we can see? I don't know

What is the link to your site? http//incontramici.inonda.tv

#1179121

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - could you please tell me what form edit link you want to add which menu?

#1179129

So, I'm creating a dating site.
I have created a Profile CPT where every user can create only one their own profile post.
I have created two Forms to edit the Profile post information.
Using Toolset Form button I have added the edit post link in the page template, but I need to insert the edit link into main menu.

What should I do to do that?

#1179162

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - I need to check what edit link it generates. Could you please tell for which form you want to add an edit link to the main menu.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#1179211
#1179777

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Thank you, I see the access details working fine but I want more information here.

For which Toolset form you want to add the link to the main menu?

#1179959

The Toolset From are "Mio Profilo FORM modifica (ID: 56)" and "Aggiungi foto (ID: 9453)".

#1179980

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

As I understand, you want to display edit post link to current loggedin user - correct? So, I've a question here, how to know -what profile post belongs to which user. Is it based on the current loggedin user - that means post author - correct? If so - we need to find the profile post whose author is belongs to current loggedin user.

Let me know if I misunderstood anything here.

In addition to that - you want to display the profile link in left menu after the menu item "REGISTER MODAL LINK" - correct?

#1179987

As I understand, you want to display edit post link to current loggedin user - correct? So, I've a question here, how to know -what profile post belongs to which user. Is it based on the current loggedin user - that means post author - correct? If so - we need to find the profile post whose author is belongs to current loggedin user.
Yes it is all correct.

In addition to that - you want to display the profile link in left menu after the menu item "REGISTER MODAL LINK" - correct?
I need to have the Profile edit link and Adding Photo link before "Messaggi 0", but them should be the second and the third menu items. For now I don't have added the first item menu because I have opened a ticket to solve some issue about the content of the first item menu.

#1180082

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Ok thanks for the clarification.

Now, I've added the following page where we display the Edit form:
=> lien caché

[cred_form form='aggiungi-foto' post="[get_profile_author_id]"]

I've also registered the [get_profile_author_id] shortcode at:
=> Toolset => Settings => Front-end Content tab => Third-party shortcode arguments section

I've added following shortcode "get_profile_author_id" to custom code section:
=> lien caché

function func_get_profile_author_id() {
 global $current_user;
 
  if(is_admin()) return;
  
 $author_id = $current_user->ID;
//  $author_id = 1;
 // exit;
  
  $args = array(
	'author'        =>  $author_id,
	'post_type'	=> 'profilo',
	'posts_per_page' => 1
);

$posts = get_posts($args);

 if(isset($posts[0])){
   return $posts[0]->ID;
 }else{
   return 0;
 }
 
}
add_shortcode( 'get_profile_author_id', 'func_get_profile_author_id' );

Where:
- You need to login as "InOnda" user.
- I've also register the shortcode

Then I've added the menu "Edit User Profile" for the page:
=lien caché

This is how I've added one form and added edit link to menu.

#1180923

Hi, thanks for the solution, but now I have the following issues:

I have created the User Registration Form (lien caché), where the role assigned to users after the registration is a custom role called "Stato Base". After the user registration form submission the new user is redirect to the login page (lien caché). After the user login the users are redirected to a specific page to create a Profile CPT Post with a specific Form managed with View where the filter is "Seleziona i post che hanno come autore l' utente attuale registrato." and the View code is

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
          [wpv-post-body view_template="modello-di-contenuto-perprofili"]
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"][cred_form form="mio-profilo-form-crea"][/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

And so, if the user don't have created the Profile CPT post, the user display the Form to create the Profile CPT post (lien caché the new page name will be mio-profilo). After the submission, the Profile CPT posts are not published but setted to "in revision", and the users are redirect to the page to add the photo (incontramici.inonda.tv/edit-user-profile/) but instead to see the form, I see the "Permission danied" message.
In Access all settings are ok...

Else, if the user have created a Profile CPT post before, in the lien caché (the new page name will be mio-profilo) the users should to see their own profiles, instead I have the Content Template with the layout that I have setted but without the custom fields values that the user have setted, and return mi this message "Il contenuto non verrà visualizzato perché produce un ciclo infinito.
Lo shortcode wpv-post-body è stato richiamato più di una volta con l'attributo view_template="modello-di-contenuto-perprofili" attraverso l'articolo "InOnda", attivando un ciclo infinito."

Why I have this issues and what shoul I do to solve them?

Les nouveaux fils créés par Minesh et associés à celui-ci sont repris ci-dessous :

https://toolset.com/fr/forums/topic/split-i-need-to-insert-the-form-edit-link-to-menu-registration-form-and-view/

#1181293

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - that's a different issue. I will split the ticket with another issue you reported.

Please feel free to close this ticket.

#1181493

My issue is resolved now. Thank you!