Toolset lets you develop truly custom sites, including WooCommerce, Membership and Directory/Classifieds sites.
Visit our dedicated tutorials to learn how to build each of these sites using Toolset:
Problem:
The user was having errors when submitting a cred form.
Solution:
It turns out that the issue comes from some erroneous conditions on some date fields. After recreating the conditions the issue has dissappeared.
Problem:
The user would like to limit posts creations for users.
Solution:
It turned out that the function "u_product_count" returned 5 for the user "croqueteria". Because the "numberposts" was not passed to get_posts, I would expect the function to return 10, from Settings->Reading, but for some reason it returns only 5.
I updated the code to introduce the "numberposts" equal to -1, to return all posts, and it worked form.
function u_product_count() {
//we create the $variable
$user_product_count = count( get_posts( array( //we get the posts
//we define the Post type
'post_type' => 'producte',
//all posts
numberposts' => -1,
//we get the current logged in author
'author' => get_current_user_id(),
) ) );
//We return the amount of posts created by user
return $user_product_count;
}