Skip Navigation

[Résolu] Favorites view

This support ticket is created Il y a 6 années et 6 mois. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Marqué : ,

This topic contains 45 réponses, has 3 voix.

Last updated by Christian Cox Il y a 6 années et 5 mois.

Assisted by: Christian Cox.

Auteur
Publications
#585690

I was able to update Types. Will the CRED update be rolled out or do I need to manually download and update?

Thanks,
Chuck

#586271

I updated CRED, but I'm still having issues. When I click the button it disappears from the page with no message displayed and nothing gets saved to the view.

Thanks,
Chuck

#586448

Okay, please apply the same patch to the updated CRED plugin. Let me know the results.

#586520

Not sure what you mean by patch, but I have everything set as it should be; still not getting the desired result.

No message shows after form is submitted.

In the view if I click to remove the post it creates an auto draft, screenshot: hidden link

Thanks,
Chuck

#586902

We released two errata posts yesterday about CRED showstopper issues that were introduced by the recent WordPress security update:
https://toolset.com/errata/cred-1-9-2-1-types-2-2-17-18-showstopper-when-using-cred-ajax-forms/
https://toolset.com/errata/cred-1-9-2-1-types-2-2-17-18-showstopper-when-using-cred-forms-with-recaptcha/

While there is a workaround for the reCAPTCHA issue, there is not currently a workaround for the AJAX form issue other than to disable AJAX submission for the form. Do either of these apply to this form?

#586923

Christian,

These do not apply. I am not using AJAX or reCAPTCHA for this form.

Thanks,
Chuck

#587216

Okay standby, I'll make a clone and take a closer look now.

#587236

In the view if I click to remove the post it creates an auto draft
The Add to Favorites CRED form is set to "Add new content" instead of "Edit existing content". This is why you're seeing new posts created. It should be set to "Edit existing content" since we're modifying the existing Motorcycle post.

- Add an "s" to the "favorite" type field name in the CRED form, it's required. I must have made a typo in the code I provided before:

[wpv-conditional if="( [types field='favorites'][/types] eq [wpv-current-user info='id'] )"]

- I don't see the JavaScript added to the CRED form's JS panel as I described here, was it deleted by mistake?
https://toolset.com/forums/topic/favorites-view/page/2/#post-581277

- Finally, the toolset_is_favorite shortcode needs to be updated to work with your custom database prefix:

add_shortcode( 'toolset_is_favorite', 'toolset_is_favorite_func');
function toolset_is_favorite_func($atts)
{
  global $wpdb;
  $post_id = $atts['id'];
  $user_id = get_current_user_id();
  $postmeta_table = $wpdb->prefix . 'postmeta';
  $favorites = $wpdb->get_results( "SELECT * FROM $postmeta_table WHERE meta_key = 'wpcf-favorites' AND post_id = $post_id AND meta_value = $user_id LIMIT 1");
  return sizeof($favorites) ? 1 : 0;
}

Please try these updates and let me know the results.

#587284

I made all those changes and we're getting close.

Screenshot before "removed from favorites" is clicked: hidden link
Screenshot after: hidden link

The button gets removed from certain posts.

Thanks,
Chuck

#587313

Can you retest that now that I have deleted the CRED Autodraft posts that were being created inadvertently before? Those were causing unexpected problems in the add/remove favorites workflow.

#588322

Christian,

I'm going to load a few more posts to the site this evening and test it out in depth. I'll let you know the result.

Thanks,
Chuck

#588352

One problem I'm noticing is the responsiveness of the "Remove form Favorites" button

Screenshot: hidden link

The class my theme uses is "x-btn x-global-btn"

I have inserted this in the CRED form and View, but am still having trouble getting the button to respond.

Does the class need to be inserted else where?

Thanks,
Chuck

#588921

If you mean the right column should stack underneath the thumbnail image, then that doesn't have anything to do with the button. It's because you're using a table to create this design. Tables are not responsive in that way. You could use a Bootstrap grid instead:
hidden link

#590412

Christian,

I have been following this thread closely as I am looking to implement the exact functionality. Where are you inserting this custom code to? Is it the JS window provided by toolset, or functions.php? If its the later, a search in my wordpress files shows multiple results, is one I should be using specifically? The themes function.php? Sorry..very new to this.

Thanks,
Tom

#590866

Ok, I was able to get some of this working by adding the jQuery to my theme's function.php file, in addition to the cred form conditional coding partnered with the jquery added to the cred JS frame.

I've ran into to one major problem, and hopefully I'm just overlooking something.

How do you allow the non-author to edit the post? When I'm logged in as the admin I'm able to see the cred form button on the posts that I have created under the admin account. But as soon as I log out, and sign in on pseudo user account, the button disappears for the same posts. I assume this is because I only allow the posts author to edit the post, and thus add their user id to the repeating post field?

The obvious solution to this is to allow everyone to edit posts, but that is just not an option for my site. I need a way to allow editing of a single field by everyone, any ideas? I'm thinking create a new post type that is just for favorites and can be edited by everyone, and somehow link it to my posts. I'm just sure how to create that link?

I hope I'm not de-railing this thread, my apologies if so, I just want this info together for others to take advantage of.

Thanks,
Tom

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.