yehudaL
Fils de soutien créés au cours des 30 derniers jours : 0
Sujets de forum favoris
This user has no favorite topics.
Sujets de forum créés
| Status | Topic | Supporter | Voix | Publications | Nouveauté |
|---|---|---|---|---|---|
|
Editing a particular record on the frontend
Commencé par : yehudaL
in: Toolset Professional Support
Problem: The customer wanted to allow coaches, defined as CPTs, to edit their own records using Toolset Forms. He explored two potential methods but was unsure how to implement them using Toolset, especially since he uses the legacy version of Views. The primary challenge was to ensure each coach could only edit their own record without using the standard WordPress authentication system. Solution: We suggested using a unique URL with a secret parameter to allow coaches to access and edit their records. The steps include: Adding a custom field (coach_secret) to each coach's profile.
add_shortcode('show_edit_coach_form', function() {
if (isset($_GET['secret'])) {
$secret = sanitize_text_field($_GET['secret']);
$args = array(
'post_type' => 'coach',
'meta_query' => array(
array(
'key' => 'wpcf-secret',
'value' => $secret,
'compare' => '='
)
)
);
$query = new WP_Query($args);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$post_id = get_the_ID();
echo do_shortcode('[cred_form form="edit-coach-form" post="' . $post_id . '"]');
}
wp_reset_postdata();
} else {
echo 'Invalid URL or no matching coach found.';
}
} else {
echo 'No URL parameter provided.';
}
});
|
|
2 | 5 | Il y a 1 year, 10 months | |
|
Re-open a support ticket
Commencé par : yehudaL in: Toolset Professional Support |
|
2 | 2 | Il y a 1 year, 10 months |