Home › Forums › Quform WordPress › To recall submitted form data for a logined user
- This topic has 17 replies, 3 voices, and was last updated 5 years, 5 months ago by Ally.
- AuthorPosts
- May 26, 2018 at 9:15 am #25814cheneyParticipant
Hi there,
I want to create a page which user can see list of their own submitted forms then click to recall what they did. The list could be a table with submitted date, title and couple key element of the submitted data as identification. If its too complicated, at least the tile and submitted date would be needed. User can tracking back user’s submitted data.
How should I do to make this page?
Regards, Cheney
May 30, 2018 at 2:30 pm #25864AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 2, 2018 at 4:00 pm #27090aaron1988ParticipantHi Ally,
I did that code in functions.php but does not seem to be returnings the {all_form_data} 🙁
October 5, 2018 at 4:18 pm #27113AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 5, 2018 at 8:00 pm #27125aaron1988ParticipantThanks, Ally i will try this.
October 23, 2018 at 12:04 pm #27285aaron1988ParticipantHi Ally,
This code works but one thing can it be change so it only shows the information for that specific user? and not everyones?
As i did 2 tests, 2 different emails and when i logged in i could see both?
Thanks
AaronOctober 23, 2018 at 6:10 pm #27306AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 23, 2018 at 10:22 pm #27310aaron1988ParticipantHi Ally,
Basically we are using some code from your documentation to Register people on Submission and once submitted then where I have put the shortcode: [user_subscribe_list] it seems to be showing 2 entries when one user is:
aaronhealey23@gmail.com and second is: facebook@bluegeeks.co.uk as examples then once form is submitted I login with: aaronhealey23@gmail.com shows me 2 entries and then when I login as facebook@bluegkeeks.co.uk I get the same ☹
Thanks
AaronOctober 24, 2018 at 10:27 am #27318aaron1988Participantthe code i am using is:
<?php
/**
* Plugin Name: Quform Custom Code
* Plugin URI: https://www.quform.com
* Description: Custom code for Quform.
* Version: 1.0.0
* Author: ThemeCatcher
* Author URI: https://www.themecatcher.net
*/
add_shortcode('show_subscribers_list', function () {
if ( ! is_user_logged_in()) {
return '';
}
$repository = Quform::getService('repository');
$formFactory = Quform::getService('formFactory');
$options = Quform::getService('options');
$form = $formFactory->create($repository->getConfig(1));
$entries = $repository->getEntries($form, array('order_by' => 'created_at', 'order' => 'ASC'));
$output = '';
if (is_array($entries) && count($entries)) {
$output .= '<table><tr>';
$output .= '<th>Overall</th>';
$output .= '<th>Listening</th>';
$output .= '<th>Reading</th>';
$output .= '<th>Writing</th>';
$output .= '<th>Speaking</th>';
$output .= '<th>Total</th>';
$output .= '<th>Gap</th>';
$output .= '</tr>';
foreach ($entries as $entry) {
set_form_values($form, $entry);
if ($form->getElement('quform_1_11')->isEmpty()) {
continue;
}
$output .= '<tr>';
$output .= '<td>' . $form->getValueHtml('quform_1_11') . '</td>';
$output .= '<td>' . $form->getValueHtml('quform_1_18') . '</td>';
$output .= '<td>' . $form->getValueHtml('quform_1_19') . '</td>';
$output .= '<td>' . $form->getValueHtml('quform_1_20') . '</td>';
$output .= '<td>' . $form->getValueHtml('quform_1_21') . '</td>';
$output .= '<td>' . $form->getValueHtml('quform_1_59') . '</td>';
$output .= '<td>' . $form->getValueHtml('quform_1_60') . '</td>';
$output .= '</tr>';
}
$output .= '</table>';
} else {
$output .= '<p>No subscribers found.</p>';
}
return $output;
});
function set_form_values(Quform_Form $form, array $entry)
{
foreach ($entry as $key => $value) {
if (preg_match('/^element_\d+/', $key)) {
$elementId = (int) str_replace('element_', '', $key);
$form->setValueFromStorage($elementId, $entry[$key]);
}
}
}
October 25, 2018 at 12:36 pm #27477aaron1988ParticipantHi Ally,
Would you like to view my setup?
Thanks
AaronOctober 26, 2018 at 10:45 am #27485AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 26, 2018 at 11:27 am #27487aaron1988ParticipantHi Ally,
I am using Quform 2.5.0 changed the part you said. and now i get: “No Subscribers Found.” and i resubmitted the form just to make sure.
Thanks
AaronOctober 29, 2018 at 4:09 pm #27525aaron1988ParticipantHi Ally,
Wondered if you had any update on this 🙂
Thanks
AaronOctober 30, 2018 at 10:11 am #27529AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 30, 2018 at 10:24 am #27534aaron1988ParticipantHi Ally,
Email has been sent 🙂
Thanks
Aaron - AuthorPosts
- You must be logged in to reply to this topic.