Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?

You could use Javascript <script type=”text/javascript”> function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(“;”); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf(“=”)); y=ARRcookies[i].substr(ARRcookies[i].indexOf(“=”)+1); x=x.replace(/^\s+|\s+$/g,””); if (x==c_name) { return unescape(y); } } } var logged_in=getCookie(“wordpress_logged_in_[HASH]”); if (logged_in!=null && logged_in!=””) { alert(“You are logged in!”); } else { alert(“You are logged out!”); } </script> NOTE: WordPress logged in cookie info can be found here. … Read more

Shopping plugin with user groups [closed]

You don’t say if you are setting up a new e-commerce site or a trying to change an existing one. If you are setting up a new site from scratch … then WooCommerce has a premium plugin called Dynamic Pricing which can create different pricing for different types of users.

One folder to be accessible by one user

One solution might be to directly restrict access to the file on the server, but utilize a url rewrite to display the content — only if the id matches in the request. Obviously this doesn’t answer every question in the scenario but it does provide a proof-of-concept to indirectly convert a url into a file. … Read more

Check if username doesn’t exists

Got it fixed. Pretty simple actually. I moved the if part where the user get’s deleted to the bottom of the script. foreach ($data as $gebruiker){ $username = $gebruiker[‘username’]; if ( username_exists( $username ) && $gebruiker[‘status’] == ‘published’ ){ $user = get_user_by( ‘login’, $username); update_user_meta( $user->ID, ‘import_1′, $gebruiker[’email’] ); }else{ $users = wp_insert_user( array( ‘user_login’ … Read more

Change WooCommerce registration form/way?

I’ve been trying out the same code snippet from Cloudways as well. If you don’t use the snippet in functions.php, but instead create a copy of the woocommerce file form-login.php in your child theme’s folder/woocommerce/myaccount. Then the fields from the Couldways snippet can be used before the line containing: <?php do_action( ‘woocommerce_after_checkout_billing_form’, $checkout ); ?>

Problem with update_user_meta() meta_value

I fixed it doing like below: $meta_value = //data from an API (e.g.: 19, 34, 1290 etc) $meta_value_string = “”. $meta_value; $user_id = wp_insert_user( $new_user_data ); update_user_meta( $user_id, ‘my_meta_key’, $meta_value_string ); Now it works fine.

Save search criteria per user and show on custom user page

Assuming that those users have accounts on your site (are subscribers, authors, or some other role), you can add custom fields to their profiles. The easiest way is to use a plugin, like Advanced Custom Fields (https://wordpress.org/plugins/advanced-custom-fields/). The fields would be available in their profile pages, and you can add, and use in any template. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)