Yesterday I spent quite a few hours coding a custom content display with link, thumbnail, and expiration all showing instead of the default tabled text/link format of WooCommerce Memberships. This provided me with some new practice in areas I have not done much of before.
Tonight I was once again exploring ways to grab some data from a restricted access point, a public visitor. In doing this I am finding more ways to bypass things myself, but provided public users a way to see a manufactured leak of private site data.
I created something so very basic which was to display how many product’s were in a Woocommerce Memberships based store from the public. Just a basic product category counts shortcode at first, thing is this particular store is set to hide all data if the visitor is not an active member. So the public would never get this data, I tried a few methods.
My final method was a bit tricky to get working right, but it was to write a custom database entry for multiple product categories and display on the front end to anyone. An active member just gets the simple query result, a visitor gets a database value. So the value gets updated when an admin or active member visits a particular page, using traffic to update but with a limit put in as precaution. I may need to better this part.
Thing is WordPress has designed so many built in custom functions the entire process is easier than vanilla PHP, once you figure it out. For instance using $wpdb and its various methods with associative array parameters was confusing at first glance. After awhile I learned how much easier it was making things, without using typical SQL commands the process is faster and you can then create your own methods to make it even easier.
So the final setup was 4 functions just to show these stats to the public using a shortcode. I was very proud to have created a bit more advanced functionality, mainly to let public visitors see there has been updates or new items in the store since they can’t see private store. I could just simply write theses values in on the designated page, but thats old school. I often forget how much PHP I know because lately it’s been all Python.
You can see this new little stats on the front page of https://artofshadows.com it is hardcoded with my own category data as is, but could be dynamic with a couple easy changes. One of my future projects is to another creation of mine ‘hash-id’ functions into my very own gallery system.
I am wanting a basic gallery with fullscreen mode, responsiveness, media and custom server folder. This basically sounds like nothing new, but will enable the hash-id system easier than the method I use now. You can retrieve the hash-id from OCR or scanning with various apps manually.