Home › Forums › Quform WordPress › Another issue with "Auto-Check Checkboxes for individual users"
- This topic has 2 replies, 2 voices, and was last updated 11 years, 4 months ago by Ally.
- AuthorPosts
- July 4, 2013 at 7:45 am #5107jrjacobs24Participant
Ok, I’ve ran into a problem that I have previously presented in this thread:
but the thread was previously resolved so I wasn’t getting a response when I tried to post in it again.
Anyways, the code before worked perfectly until we added more publishers. I went in and added to the code all the necessary form id’s, but I keep getting an error and my form info is not being displayed like it was when it was working properly. My thinking is that since not every entry is going to return a value (someone might not select a comic (value) from a publisher (entry)) that the array is not functioning properly. My code looks like this at the moment:
function mytheme_set_subscribed_comics($form)
{
if (is_user_logged_in()) {
global $current_user;
$comics = array_merge(
$form->getValue('iphorm_1_1'),
$form->getValue('iphorm_1_2'),
$form->getValue('iphorm_1_3'),
$form->getValue('iphorm_1_4'),
$form->getValue('iphorm_1_5'),
$form->getValue('iphorm_1_6'),
$form->getValue('iphorm_1_7'),
$form->getValue('iphorm_1_8'),
$form->getValue('iphorm_1_9'),
$form->getValue('iphorm_1_10'),
$form->getValue('iphorm_1_11'),
$form->getValue('iphorm_1_12'),
$form->getValue('iphorm_1_13'),
$form->getValue('iphorm_1_14'),
$form->getValue('iphorm_1_15'),
$form->getValue('iphorm_1_16'),
$form->getValue('iphorm_1_17'),
$form->getValue('iphorm_1_18'),
$form->getValue('iphorm_1_19'),
$form->getValue('iphorm_1_20'),
$form->getValue('iphorm_1_21'),
$form->getValue('iphorm_1_22'),
$form->getValue('iphorm_1_23'),
$form->getValue('iphorm_1_24'),
$form->getValue('iphorm_1_25'),
$form->getValue('iphorm_1_26'),
$form->getValue('iphorm_1_27'),
$form->getValue('iphorm_1_28'),
$form->getValue('iphorm_1_29')
);
update_user_meta($current_user->ID, 'subscribed_comics', $comics);
}
}
add_action('iphorm_post_process_1', 'mytheme_set_subscribed_comics');
function mytheme_get_subscribed_comics($value)
{
if (is_user_logged_in()) {
global $current_user;
$value = get_user_meta($current_user->ID, 'subscribed_comics', true);
}
return $value;
}add_action('iphorm_element_value_comics', 'mytheme_get_subscribed_comics');
What should I do to make it ok that some entries won’t return a value? (i.e. I choose comics from Marvel (iphorm_1_1), DC (iphorm_1_2) and Image (iphorm_1_3) but not Dark Horse (iphorm_1_4))
I hope this wasn’t too confusing haha Thanks!
July 4, 2013 at 6:07 pm #5117jrjacobs24ParticipantSorry, just realize the link to my previous thread didn’t post like it should. Here it is:
Auto-Check Checkboxes for individual usersJuly 5, 2013 at 12:29 pm #5131AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.