Skip Navigation

[Gelöst] Let an admin edit users through a cred form

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by erikd-6 vor 6 Jahre, 3 Monate.

Assisted by: Shane.

Author
Artikel
#604761

Tell us what you are trying to do? Trying to let an admin edit user forms (Cred)

Is there any documentation that you are following? https://toolset.com/forums/topic/cred-edit-user-form-only-allowing-me-to-edit-my-own-profile/

Is there a similar example that we can see? See the above mentioned thread

What is the link to your site? hidden link

I am trying to follow the instructions Beda gave in the thread https://toolset.com/forums/topic/cred-edit-user-form-only-allowing-me-to-edit-my-own-profile/ but all the links are shown as 'hidden link' which makes it hard to follow the example.

I have managed to create a view that lists all users of a certain role, see hidden link
The main part of this view is the following code:

  • <a href='hidden link field="ID"]'>[wpv-user field="display_name"]</a>
  • The urls in the dropdown created by this view are like hidden link where the number at the end is the variable user-id, but all user-id's open a page with the same user, so the url parameter is not working.

    The view to open the cred form has this code inside the loop: [cred_user_form form="bewerk-profiel-door-gebruiker" user="[wpv-user field='ID']"]

    What am I doing wrong?

    Erik

    #604858

    Shane
    Supporter

    Languages: Englisch (English )

    Timezone: America/Jamaica (GMT-05:00)

    Hi Erik,

    Thank you for contacting our support forum.

    Would you mind providing me with admin access tot he website so that I can have a look at what has been done so far ?

    The private fields will be enabled for your next response.

    Thanks,
    Shane

    #605029

    Hi Shane, I solved the issue.

    It appeared that the view containing the edit user form was served from cache. I found the setting to turn the cache off when inserting the view in a page.

    [wpv-view name="test-view" cached="off"]

    Moreover I found out how to pass an url parameter to a user form. I will put the code below for other users to view, as I could not find this in the docs.

    Inside the loop of the view that shows the edit user form:

     [cred_user_form form="edit-profile" user="[get_cred_urlparam]"]

    The shortcode

    [get_url_parameter]

    is a custom function I put inside functions.php of the child theme. Here is the function:

    add_shortcode( 'get_cred_urlparam', 'cred_field_urlparam');
    function cred_field_urlparam($attr) {
         return $_GET['user_id'];    
    }
    

    Since I only needed the url parameter 'user_id' I could keep it this simple.
    If you know a better way to add an url parameter to a cred user form, please let me know.
    This works.

    Erik

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