Skip Navigation

[Resolved] Use CRED user form on single page and not inside the content

This support ticket is created 6 years, 11 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 3 replies, has 2 voices.

Last updated by davidM-26 6 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#525035

I have a website that requires dealers to log in and see private info.

The business wants to manage the users on the front end.

I have made a view that shows all the current dealer logins. Next to each one is an EDIT link and that links to a CRED user edit form.

But, this form loads on the same page which seems silly. The title is "List all dealers" yet the edit form shows. And under the edit form, it shows the list of dealers again except only the current one.

I did create a standalone page called "Edit a Dealer" and put the CRED form on this though I don't think there's anyway to link to that page and pass the user information.

I hope this makes sense.

#525168

Nigel
Supporter

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

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

Hi David

I looked into this, it was more problematic than I'd expected as it relies on a couple of undocumented things and there is a bug in the current version of CRED which was affecting my testing.

This solution should bypass the bug, but in any case new versions of our plugins are expected in a few days time, including CRED.

So, you need a CRED edit user form, and you need a static page where you insert the form using the cred_user_form shortcode.

Currently your problem is that this will edit the current user and not the desired user.

If you are not already, you must have Access installed and active to be able to use CRED to edit users other than yourself (even if you use Access for nothing else).

The cred_user_form shortcode lets you set the user id, but on the static page where you insert the form you don't have the context to know what the required id is.

However, we can use the URL parameter user_id which drives the cred_link_user_form functionality where the form appears on the same page as the link to pass our user id.

So, in the View which lists users we will make our own link to the static page with the edit user form and append the user_id URL parameter to it. Note that you could manually insert the full URL, but I generate the URL based on the id of that static page (9 in my example), like so:

<p>Edit <a href="[wpv-post-url id='9']?user_id=[wpv-user field='ID']">[wpv-user field="display_name"]</a></p>

Does that make sense? Try it yourself and let me know how you get on. I'm going to create an internal ticket to improve our documentation on user edit forms, which is currently somewhat lacking.

#525243

That's perfect.

Granted, it's a long way to do it, and it's something I reckon should be easier? But I really appreciate that. It's a far cleaner look for a business to do it that way than to have weird pages with information that isn't really needed on the page.

#525249

I'm surprised there's no way to add a DELETE link the same way

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