Skip Navigation

[Geschlossen] Help using Toolkit to create user profiles

This support ticket is created vor 10 Jahre, 9 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
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

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

This topic contains 3 Antworten, has 2 Stimmen.

Last updated by Caridad vor 10 Jahre, 9 Monate.

Assisted by: Caridad.

Author
Artikel
#61582

I'm not sure what I'm doing wrong, but I need some direction in how to set up user profiles. I would like a way for visitors to our site to be able to set up user profiles. The profiles should have the ability to be edited if needed.

So far, I've created a post type called "profiles". I've used Cred to create the form using the "auto generated" option to use the fields in my profiles post type. So far, this looks good, but when I do a trial run and submit some content, it just shows "Auto Draft" and doesn't display my post. I have the Cred setting set to publish, and I have Access set to edit, delete, publish, etc. (author, contributor & guest).

So, why can't I see the post after I submit?

Thank you!

#62092

Dear Dawn

For this to work you need each user to have one profile only and use an edit form. To do this you will need to add some custom code that automatically adds one profile for each user, so that it can be edited.

For example, this shortcode will return the profile id to edit, if it doesnt exist it is created:

add_shortcode('wpv-post-profile-id', 'current_profile_id_shortcode');
function current_profile_id_shortcode() {
global $current_user;
$user = get_posts('post_type=profile&meta_key=wpcf-user_id&meta_value=' . $current_user->ID);
if (empty($user)) {
   $id = wp_insert_post(array('post_type' => 'profile'));
   update_post_meta($id, 'wpcf-user_id', $current_user->ID);
   return $id;
} else {
   return $user[0]->ID;
}
}

Next place your edit form in a page like this:

[cred-form form="My Profile" post="[wpv-post-profile-id]"]

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#62363

Thank you for the quick reply. Where, exactly, do I add the code?

add_shortcode('wpv-post-profile-id', 'current_profile_id_shortcode');
function current_profile_id_shortcode() {
global $current_user;
$user = get_posts('post_type=profile&meta_key=wpcf-user_id&meta_value=' . $current_user->ID);
if (empty($user)) {
$id = wp_insert_post(array('post_type' => 'profile'));
update_post_meta($id, 'wpcf-user_id', $current_user->ID);
return $id;
} else {
return $user[0]->ID;
}
}

#62492

Dear Dawn,

You can put it in functions.php of your theme. At end, before the closing php tag ?>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

Das Thema „[Geschlossen] Help using Toolkit to create user profiles“ ist für neue Antworten geschlossen.