How to hide Published Custom Post if a users membership has expired - wordpress

WordPress Experts
can anyone help me with this topic?
I am creating a directory for a client. They have a membership site using woocommerce subscriptions. I created a custom post type for their members to manage their listings. I am trying to hide listings for anyone who lets their membership expire. I can't find a way to do it. It seems to me that this should be possible but I haven't found a solution and I am hoping I might have missed it or that someone else may have come across this already.
Any help is greatly appreciated.

You can use the wc_memberships_user_membership_status_changed hook to catch every membership's status update. Whenever a membership becomes cancelled or expired, you need to:
Get user ID
Get all user's posts belonging to your custom post type
Loop through each post and update its status to private using the wp_update_post() function (or run a single SQL query doing the same thing)

Related

Getting Subscription Products from WooCommerce

I am trying to access my site's Subscription Products via REST API. At wc/v1/subscriptions I can get the active subscriptions, and at wc/v3/products I can get all products except subscriptions.
There isn't anything in the WC Subscriptions documentation about subscription products. This site implies that I can provide an API for this, but I am not a PHP programmer. I do have access to the server and can put code in functions.php or wherever it would belong.
Can anyone provide me with the code to achieve this? I ask here because I hope it's relatively simple, like the get_posts_meta code I've found on a number of blogs/sources to expose some other API data.
Thanks a lot.

How to get a copy of a Woocommerce order on an e-mail?

I am currently making a webshop for a client, and they wish (if possible) to avoid using WooCommerce and Wordpress as much as possible.
Currently the buyer receives a confirmation e-mail with the order details, the billing address, and other information about their purchase.
My question:
Would it be possible to get a copy of this mail, sent to their e-mail automatically?
The client currently handles all orders over e-mail, and wish to continue in this fashion.
Thanks a lot.
I've tried troubleshooting on Google, but without any luck. I've always tried downloading some plugins that I thought might help, but again without any luck. Running WooCommerce on Wordpress.
Found the way to fix this... If anyone reads in the future:
Go to:
WooCommerce < Settings < Emails < New Order... There you can specify an e-mail.

Woocommerce checkout form after filling gives error "Fill in the required fields"

I have worked on a website that was built many years ago by a developer who is not updating it. recently I have added Woocommerce. but there is a problem. after filling the checkout form there is an error msg appears saying please fill in all the required fields although filling them all. it happens for all payment gateways. but if the user logged in it works and proceed to Paypal or whatever payment gateway. so this problem happens only if the user is not logged in.
I have dequeued the javascript files and deactivated the plugins and there is no way. is there any idea?
The information is most likely a primary key for the table. When a user signs up they enter the data into the SQL DB so it will not render an error for a signed up user to make a purchase. If a user is not signed up the information will need to be entered for your database to be relational(SQL will have a requirement for this data). This is the reason you are rendering the error. Your fix is one of the following:
1)Display the required entry field by commenting out the css.
2)Depending on the size of the shop and how much work you need to do it might be faster and easier to rebuild it.
3)Rewrite the Database from normal form.

Add user on UrBackup server after order on Woocommerce site

I have wordpress site with woocommerce shop and I’m selling among others UrBackup client accounts on my server.
Do you have any idea how to automatically add UrBackup user after order in woocommerce?
Or maybe easier will be create shop based on different engine?
Any advice, tips? :)
After poking around a bit, it looks like UrBackup has an API you can use, that most likely has a 'create account' endpoint. I didn't see it immediately in their not-so-great documentation, but you'd think it'd HAVE to be there somewhere! There's also a PHP API kit you could integrate into your WordPress site here:
https://bitbucket.org/opensaucesystemsdevelopment/urbackup-api.git
So, you could load in this class, and after a WooCommerce order is placed, call the API endpoint to create a user. To do this with WooCommerce, you'd need to create a function on the "woocommerce_order_status_completed" hook.
http://hookr.io/actions/woocommerce_order_status_completed/
This would let you run any custom code you'd like after an order's payment has completed. Thus, you could check an order for if it contains the UrBackup product, and if so call the UrBackup API to create an account based on the current user's data.
Should work!

New user registration spam

My website uses Wordpress and we use a plugin called profile builder for registering new users who can access some more pages than non-registered ones. We have e-mail confirmation feature and do not auto-generate passwords. Lately we are seeing a lot of spam user ids being created. They never access the site. I wanted to know what possible benefit they might be getting by registering on our site and if we should delete off such ids. Is there any way to prevent it from happening.
In my experience, comment spammers generally sign up for the sole purpose of posting comments that ostensibly contain generic comments about the post (such mundane remarks as "wow this is really interesting"), but the real purpose is for them to post links to their websites in the hope of boosting their search engine ranking. If they're registering but not returning it could be some bot that's trying to perform automatic registrations in the hope that it can go on to automatically post comment spam.
To prevent it from happening, you could try adding a Captcha to your registration process, if that plugin will allow it.
If you find yourself getting comment spam then there's always the askismet plugin.
You have to install stop spammers plugin. If you didn't like it then you can choose one of these, Sabre, Growmap, wangguard. :)

Resources