Skip Navigation

[Closed] Trying this again because I am still missing something here.

This support ticket is created 7 years, 9 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by Nigel 7 years, 9 months ago.

Assisted by: Nigel.

Author
Posts
#433777

I am trying to make a front end cred form for creating and editing a custom post type.

My goal is to have a personal profile page for the user and have a list of the custom posts they have made. I planned to pull that by the author field so it only shows what they made. I am able to present info in views but have not done it as a link yet to take them to the form on the from end to edit it. This may be the piece I am missing here I am not sure. Is there a way in a view to automatically list the posts by the fields I chose as a link so when clicked it opens up the cred edit form?

I have no problem making the create form. It works and will create the post type fine.

I made an edit form but I continue to get post type mismatch. I have watched your training and the guides numerous times. My question is how does the cred edit form know which post it should be editing? If I am making it off the create form and I load that form in a page its blank because it is all ready to create a new post. Obviously if I edit a custom post in the back end it does not use this form. Either some quick guidance or a tutorial that actually covers this part would be great.

I started playing with my content template thinking something was wrong there and messed up a lot of my views I was using. A whole bunch of loop items wound upo in the trash automatically. Hopefully someone can help me with this hurdle.

#433983

Nigel
Supporter

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

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

Screen Shot 2016-09-08 at 10.22.06.png

Hi Ted

The typical way CRED edit forms are implemented would be something like this:

- you have a custom post type of "projects" and you make a CRED post form to create projects from the front end
- you clone your form and make the new form one which edits rather than creates projects
- you create a Content Template to display single projects

This will include a shortcode to display the project content (wpv-post-body) and then below that you would insert a shortcode to add a link to edit that post.

You can use the CRED button in the editor to insert the shortcode, or you can do it manually.

In the attached screenshot you can see me inserting an edit form called "Edit expiring posts" into my template, which inserted the following shortcode:

[cred_link_form form='211' form_name='Edit expiring posts' text='Edit %TITLE%' target='_self']

Now whenever I view a single project, I will see an edit link for that same project.

You may want to wrap the cred link in a conditional shortcode to only show it if the currently logged-in user is the author of the post, for example (i.e. people can only edit their own content).

Now, in your case you want a View which lists the custom posts (let's keep calling them 'projects') on a profile page.

So your view will show projects, and it will need a query filter for the post author where the post author is the currently logged in user, so people only see their own projects.

Now you can add the shortcodes for your content directly in the loop output section, but, except in very simple cases, it is good practice to add a content template here. The content template is where you will add the CRED link as I described above.

I hope that covers what you need, but if something is missing, please ask away.

#434728

OK after going through this I see how the content template is what gets the edit button and it actually worked! lol This leaves me with a few more questions.

I am not using the title. This is for sports players and I have a first name and last name field. I really did not want to use the title. When I was just viewing the content form it showed first and last fine. Now I have Auto Draft back on the top. Is there a way to Have the first name field a space and then the last name field auto populate the post title field?

I have created views with searches successfully from the data. Even pulled author and taxonomy info into the views and filter abilities so the data can be searched. I am presenting the info in a table format. Is there a simple way to add a link either next to the player or to make their last name a link to take them to the individual front end view? Better yet how about a column next to each name that the users with the rights will have the edit button?

Last piece. Right now I have the content template and the cred forms that include all the fields for the post type. Lets say I wanted a real simple cred form that would only allow the ability to edit 3 fields instead of all the fields. Can I use the same content template and just make a pair of cred forms that contain only the 3 fields I want available for that user?

Thank you for getting me over this hump with editing. I have been frustrated with this part for a while now.

Ted

#436129

Nigel
Supporter

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

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

Hi Ted

I have been absent for a couple of days and am travelling today and just managed to pop online to say, apologies for the lack of communication, I will get back to you as soon as I can, I haven't forgotten about you.

#436420

Nigel
Supporter

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

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

Hi Ted

So, to your questions:

- Is there a way to Have the first name field a space and then the last name field auto populate the post title field

I don't quite follow exactly what you mean. I gather you want to display a single Sports Player (that's a custom post type, right?) which doesn't show the title but instead shows First name Last name, or failing that, make the post title First name Last name.

This is what is confusing me "When I was just viewing the content form it showed first and last fine. Now I have Auto Draft back on the top.". Can you clarify where and when you are displaying the Sports Player when you have the problem?

- Better yet how about a column next to each name that the users with the rights will have the edit button?

You can insert a CRED edit form link wherever you like, but, importantly, if you insert it alongside the post which it will be editing then it will have the context for which post it will be editing. So, above, I described adding it to a content template for your single custom posts, but you could equally add it to the loop output section of a view (or the content template you are linking to in that loop output) and add the link there. If you are outputting content in a table there is nothing to stop you adding the link as a button in the last column of the row.

- Can I use the same content template and just make a pair of cred forms that contain only the 3 fields I want available for that user?

You can make as many variants of your CRED edit form as you like and when inserting the edit link choose the required form. If you auto-generate your form, or you clone the create post form, then you just need to manually edit the form markup and take out the bits you don't need.

The topic ‘[Closed] Trying this again because I am still missing something here.’ is closed to new replies.