Skip Navigation

[Resolved] FOLLOW-UP: Saving Logged-in User Selected Query Results by Checkboxing to a User

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.

This topic contains 20 replies, has 4 voices.

Last updated by Christian Cox 3 years, 9 months ago.

Assigned support staff: Christian Cox.

Author
Posts
#587859

For Christian,

This is an update: I competed the requested support tasks and created Admin/ftp...etc. Need to send private error text and credentials.

I am trying to: Complete a task for a support request that was unexpectedly closed.

Link to a page where the issue can be seen: https://toolset.com/forums/topic/saving-logged-in-user-selected-query-results-by-checkboxing-to-a-user-bin/

I expected to see: more time to respond

Instead, I got: CLOSED

#587964

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Jan

I'll re-assign this to Christian to follow up. It will be a few hours before he starts.

#588306

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I'm sorry, those login credentials do not work for me. Can you check? I will enable private reply fields again in case you need to send updated credentials.

#588852
#588933

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Okay thanks I was able to log in successfully. I see that you're using the theme "Unicum", but you don't have a child theme installed. Making changes directly to a 3rd-party theme's functions.php file is not recommended, because updates to the theme will overwrite your code. It's always recommended to create a child theme and make your changes in a child theme's functions.php file. More info here:
https://codex.wordpress.org/Child_Themes

With that being said, can you provide the error log that you mentioned before? I can enable private reply fields here where you can copy + paste a brief log, or you can post a download link for a larger log. No need to supply valid FTP or login info here, just add to the comments area.

#589668
#589890

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I am guessing your child theme error was caused by this line:

if ( ! function_exists( 'wplab_unicum_setup' ) ) :

There's no endif; so this block is unterminated. That would definitely lead to an error. I'll be glad to try to make some changes, but I'm not able to access your site with FTP using the credentials you provided. I'd rather not make changes without FTP access, because a typo could bring your site down and I wouldn't be able to access the files on the backend. Can you check those FTP credentials for me? Is there a server IP address restriction? Private reply fields enabled again here.

Also - is it okay for me to install the Duplicator plugin and create a clone of your site so I can do the necessary changes on a local copy before deploying them to your live site?

#590392

is this private? Private message disappeared. See edited private message above ... LAST LINE.

#591000

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Okay thanks, I was able to set up a clone and determine what's going on with your child theme. Please replace the functions.php file with this content to enable the child theme:

<?php
function wplab_unicum_enqueue_styles() {

    $parent_style = 'wplab-unicum'; // This is 'wplab-unibum' for the Unicum theme.

    wp_enqueue_style( $wplab_unicum, get_template_directory_uri() . 'https://cdn.toolset.com/style.css' );
    wp_enqueue_style( 'wplab-unibum-child',
        get_stylesheet_directory_uri() . 'https://cdn.toolset.com/style.css',
        array( $wplab_unicum ),
        wp_get_theme()->get('Version')
    );
}
add_action( 'wp_enqueue_scripts', 'wplab_unicum_enqueue_styles' );

/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support for post thumbnails.
 *
 * @since Cosa 1.0
 */

// Playbox Wishlist action from CRED
add_action('cred_save_data_1583', 'update_user_wishlist',10,2);
function update_user_wishlist($post_id, $form_data) {
  $item_id = $_REQUEST['itemid'];
  add_user_meta($post_id, 'wpcf-item-id', $item_id);
}

I see that form 1583 is a Post Edit form, and I don't see any code in place to support the edit User form I mentioned before. Which edit User form should I be looking at? Where is it implemented on the front-end of your site?

#591412

Christian,

Corrected the Child theme, but reverted to Parent for now. Hope the below info helps. I'm pretty sure I misinterpreted location for the code before the submit button as instructed.

/** Post Form for the data being output to the search results is (ID: 1583)

/** Loop output Search Results View: (ID: 5562)

/** Location in the Search View 5562 for action on Line 47:
<td class="center aligned"><span class="glyphicon glyphicon-heart-empty" aria-hidden="true"></span></td>

/** Edit User Form: Edit User Playbox Wishlist (ID: 5572)

-------------------------
Thanks.

#591725

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Okay here's what you need to do to get this working:
- Insert CRED form in View 5562, replacing the heart icon

<td class="center aligned">
   <!--<span class="glyphicon glyphicon-heart-empty" aria-hidden="true"></span>-->
   [cred_user_form form='edit-user-playbox-wishlist' form_name='Edit User Playbox Wishlist']
</td>

- If you want to style the submit button or use a heart icon image instead, you can customize the submit button in the CRED form editor.
- Correct the form ID in cred_save_data hook
- Update item ID field slug to match yours: wpcf-itemid

add_action('cred_save_data_5572', 'update_user_wishlist',10,2);
function update_user_wishlist($post_id, $form_data) {
  $item_id = $_REQUEST['itemid'];
  add_user_meta($post_id, 'wpcf-itemid', $item_id);
}

I tested it out and it's saving favorites as expected for me now.

#593008

On Thanksgiving holiday. Will return with update on Monday. Do not close.

#593549

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi janO-3,

Christian is on vacation. This is Minesh here and I'll take care of this ticket and try to help you further. Hope this is OK.

Please let me know if you need further assistance.

#593669
playbox-error.png

Almost there. I edited the View and Child function.php as instructed. I must still be missing something. Page View in the field <td></td> prints "No user specified". How does it know? How do we specify user type?

To use this feature a user must be logged in at a specific level or asked to login with level credentials to use the wishlist feature.

Thanks

#593747

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi janO-3,

Could you please tell me what is your expected output with one test case example and please share clear steps to follow that will help me to guide you in right direction.