Downloadable Product Permission Issue – Grant Access automatically

When I order downloadable products, I can’t see them in my downloads page. When I checked the order details in the admin side, I saw that the downloadable product permissions part is blank even if the status of my order is completed.

I used paypal sandbox for testing. The order status was initially on-hold, and then I changed it to completed.

My functions.php:

function has_bought_item( $  product_id ) { global $  wpdb;  if( ! is_user_logged_in() )     return false;  $  current_user = wp_get_current_user();  $  statuses      = array_map( 'esc_sql', wc_get_is_paid_statuses() );  // Count the number of products $  count_query = $  wpdb->get_var( "     SELECT COUNT(woim.meta_value) FROM {$  wpdb->prefix}posts AS p     INNER JOIN {$  wpdb->prefix}postmeta AS pm ON p.ID = pm.post_id     INNER JOIN {$  wpdb->prefix}woocommerce_order_items AS woi ON p.ID = woi.order_id     INNER JOIN {$  wpdb->prefix}woocommerce_order_itemmeta AS woim ON woi.order_item_id = woim.order_item_id     WHERE p.post_status IN ( 'wc-" . implode( "','wc-", $  statuses ) . "' )     AND pm.meta_key = '_customer_user' AND pm.meta_value = $  current_user->ID     AND woim.meta_key IN ( '_product_id', '_variation_id' )     AND woim.meta_value = $  product_id " ); // Return true boolean value if count is higher than 0, if not false return $  count_query > 0 ? true : false; }  // Shop and archives - Replace add to cart ajax button to a custom linked button add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_loop_add_to_cart', 20, 2 ); function replace_loop_add_to_cart( $  html, $  product ) { if( has_bought_item( $  product->get_id() ) ) {          $  text = __("Download", "woocommerce");          $  user_id = get_current_user_id();     $  downloads = wc_get_customer_available_downloads($  user_id);      if (!empty($  downloads)) {         foreach ($  downloads as $  download) {             if ($  download['product_id'] === $  product->get_id()) {                 $  link = $  download['download_url'];             }         }     }      $  html = '<a href="' . $  link . '" class="button alt add_to_cart_button">' . $  text . '</a>'; } return $  html; }  function add_completed_status_to_download_permission($  data, $  order) { if ( $  order->has_status( 'completed' ) ) { return true; } return $  data; } add_filter('woocommerce_order_is_download_permitted', 'add_completed_status_to_download_permission', 10, 2); 

My system status report:

### WordPress Environment ### WordPress address (URL): https://stg.myscrapchick.com Site address (URL): https://stg.myscrapchick.com WC Version: 4.3.1 REST API Version: ✔ 1.0.10 WC Blocks Version: ✔ 2.7.2 Action Scheduler Version: ✔ 3.1.6 WC Admin Version: ✔ 1.3.1 Log Directory Writable: ✔ WP Version: 5.4.2 WP Multisite: – WP Memory Limit: 2 GB WP Debug Mode: – WP Cron: – Language: en_US External object cache: –  ### Server Environment ###  Server Info: Apache PHP Version: 7.3.17 PHP Post Max Size: 2 GB PHP Time Limit: 600 PHP Max Input Vars: 16384 cURL Version: 7.29.0 NSS/3.44  SUHOSIN Installed: – MySQL Version: 5.5.5-10.2.31-MariaDB Max Upload Size: 2 GB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔  ### Database ###  WC Database Version: 4.3.1 WC Database Prefix: wp_ Total Database Size: 4286.03MB Database Data Size: 2622.78MB Database Index Size: 1663.25MB wp_woocommerce_sessions: Data: 0.54MB + Index: 0.02MB + Engine MyISAM wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_downloadable_product_permissions: Data: 196.98MB + Index: 184.73MB + Engine MyISAM wp_woocommerce_order_items: Data: 80.96MB + Index: 44.21MB + Engine MyISAM wp_woocommerce_order_itemmeta: Data: 643.68MB + Index: 440.29MB + Engine MyISAM wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_actionscheduler_actions: Data: 1.55MB + Index: 0.58MB + Engine MyISAM wp_actionscheduler_claims: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_actionscheduler_groups: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_actionscheduler_logs: Data: 1.14MB + Index: 0.91MB + Engine MyISAM wp_commentmeta: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_comments: Data: 2.17MB + Index: 1.23MB + Engine MyISAM wp_email_log: Data: 152.56MB + Index: 0.00MB + Engine InnoDB wp_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_ninja_table_items: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 6.19MB + Index: 0.21MB + Engine MyISAM wp_postmeta: Data: 1251.84MB + Index: 837.68MB + Engine MyISAM wp_posts: Data: 140.07MB + Index: 45.37MB + Engine MyISAM wp_ppgc_categories: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_ppgc_customers: Data: 2.09MB + Index: 2.91MB + Engine MyISAM wp_ppgc_orders: Data: 28.50MB + Index: 22.76MB + Engine MyISAM wp_ppgc_products: Data: 0.18MB + Index: 0.26MB + Engine MyISAM wp_simple_history: Data: 7.52MB + Index: 4.03MB + Engine InnoDB wp_simple_history_contexts: Data: 34.56MB + Index: 26.08MB + Engine InnoDB wp_termmeta: Data: 0.01MB + Index: 0.02MB + Engine MyISAM wp_terms: Data: 0.01MB + Index: 0.02MB + Engine MyISAM wp_term_relationships: Data: 0.21MB + Index: 0.42MB + Engine MyISAM wp_term_taxonomy: Data: 0.02MB + Index: 0.01MB + Engine MyISAM wp_tinvwl_analytics: Data: 1.52MB + Index: 0.36MB + Engine InnoDB wp_tinvwl_items: Data: 0.44MB + Index: 0.00MB + Engine InnoDB wp_tinvwl_lists: Data: 0.14MB + Index: 0.00MB + Engine InnoDB wp_usermeta: Data: 56.78MB + Index: 45.81MB + Engine MyISAM wp_users: Data: 2.85MB + Index: 2.79MB + Engine MyISAM wp_wcpv_commissions: Data: 0.30MB + Index: 0.00MB + Engine InnoDB wp_wcpv_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_notes: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_admin_note_actions: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_category_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_customer_lookup: Data: 0.19MB + Index: 0.14MB + Engine MyISAM wp_wc_download_log: Data: 0.60MB + Index: 0.50MB + Engine MyISAM wp_wc_order_coupon_lookup: Data: 0.04MB + Index: 0.06MB + Engine MyISAM wp_wc_order_product_lookup: Data: 0.81MB + Index: 0.60MB + Engine MyISAM wp_wc_order_stats: Data: 0.16MB + Index: 0.14MB + Engine MyISAM wp_wc_order_tax_lookup: Data: 0.05MB + Index: 0.05MB + Engine MyISAM wp_wc_product_meta_lookup: Data: 0.16MB + Index: 0.20MB + Engine MyISAM wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_wc_webhooks: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wfblockediplog: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_wfblocks7: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfconfig: Data: 1.39MB + Index: 0.00MB + Engine InnoDB wp_wfcrawlers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilechanges: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilemods: Data: 2.52MB + Index: 0.00MB + Engine InnoDB wp_wfhits: Data: 1.52MB + Index: 0.28MB + Engine InnoDB wp_wfhoover: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfknownfilelist: Data: 1.52MB + Index: 0.00MB + Engine InnoDB wp_wflivetraffichuman: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wflocs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wflogins: Data: 0.47MB + Index: 0.16MB + Engine InnoDB wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfnotifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfpendingissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfreversecache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfsnipcache: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfstatus: Data: 0.13MB + Index: 0.09MB + Engine InnoDB wp_wftrafficrates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB  ### Post Type Counts ###  attachment: 8211 ctct_forms: 3 ctct_lists: 5 custom_css: 2 customize_changeset: 36 elementor_library: 20 nav_menu_item: 9 page: 18 post: 160 product: 2533 revision: 410 shop_coupon: 19 shop_order: 577585 shop_order_refund: 34  ### Security ###  Secure connection (HTTPS): ✔ Hide errors from visitors: ✔  ### Active Plugins (26) ###  ManageWP - Worker: by GoDaddy – 4.9.6 WC Thanks Redirect: by Nitin Prakash – 2.2 – Installed version not tested with active version of WooCommerce 4.3.1 Better Search Replace: by Delicious Brains – 1.3.3 Classic Editor: by WordPress Contributors – 1.5 Constant Contact Forms for WordPress: by Constant Contact – 1.8.5 Login/Signup Popup ( Inline Form + Woocommerce ): by XootiX – 2.0 – Installed version not tested with active version of WooCommerce 4.3.1 Elementor Pro: by Elementor.com – 2.9.5 Elementor: by Elementor.com – 2.9.13 Email Log: by Sudar – 2.3.2 Site Kit by Google: by Google – 1.10.0 Grant download permissions for past WooCommerce orders: by Claudio Sanches – 0.0.2 – Installed version not tested with active version of WooCommerce 4.3.1 Insert Headers and Footers: by WPBeginner – 1.4.5 Kadence WooCommerce Email Designer: by Kadence WP – 1.4.2 – Installed version not tested with active version of WooCommerce 4.3.1 Regenerate Thumbnails: by Alex Mills (Viper007Bond) – 3.1.3 Remove Widget Titles: by Stephen Cronin – 1.0 Simple CSS: by Tom Usborne – 1.1.1 Simple History: by Pär Thernström – 2.34.0 Smoother: by Merkulove – 1.0.5 User Menus: by Code Atlantic – 1.2.3 WP Sheet Editor - WooCommerce Products (Premium): by WP Sheet Editor – 1.5.0 – Installed version not tested with active version of WooCommerce 4.3.1 Woo Title Limit: by Dima W. – 2.0.0 – Installed version not tested with active version of WooCommerce 4.3.1 WooCommerce Product Vendors: by WooCommerce – 2.1.32 – Installed version not tested with active version of WooCommerce 4.3.1 WooCommerce: by Automattic – 4.3.1 Wordfence Security: by Wordfence – 7.4.8 WordPress Importer: by wordpressdotorg – 0.7 WP Mail SMTP: by WPForms – 2.1.1  ### Inactive Plugins (5) ###  Already In Cart / Already Purchased: by MyThemeShop – 1.0.2 – Installed version not tested with active version of WooCommerce 4.3.1 TI WooCommerce Wishlist: by TemplateInvaders – 1.20.5 – Installed version not tested with active version of WooCommerce 4.3.1 WooCommerce Products Layout for Elementor: by AD-Theme – 1.0 – Installed version not tested with active version of WooCommerce 4.3.1 WP DataTable: by Samuel Behan – 0.2.5 WP Super Cache: by Automattic – 1.7.1  ### Must Use Plugins (2) ###  ManageWP - Worker Loader: by GoDaddy – Nexcess Managed Apps: by Nexcess – 1.9.1  ### Settings ###  API Enabled: ✔ Force SSL: – Currency: USD ($  ) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable)  Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5)  Connected to WooCommerce.com: –  ### WC Pages ###  Shop base: #5 - /shop/ Cart: ❌ Page does not contain the shortcode. Checkout: ❌ Page does not contain the shortcode. My account: ❌ Page does not contain the shortcode. Terms and conditions: #577437 - /terms-of-use-copyright/  ### Theme ###  Name: GeneratePress Child Version: 0.1 Author URL: https://tomusborne.com Child Theme: ✔ Parent Theme Name: GeneratePress Parent Theme Version: 2.4.2 Parent Theme Author URL: https://tomusborne.com WooCommerce Support: ✔  ### Templates ###  Overrides: generatepress_child/woocommerce/order/order-downloads.php generatepress_child/woocommerce/single-product/add-to-cart/simple.php  ### Action Scheduler ###  Complete: 6,179 Oldest: 2020-05-26 17:41:33 -0400 Newest: 2020-08-06 16:19:38 -0400 

I know we can manually grant access per order but access should be granted automatically, right? any help is highly appreciated.

Does a character automatically fail one death save when they drop below 0 hit points?

Hey guys so I have a question regarding death saves and if anyone knows an official source that can determine this.

So according to my dms interpretation of the RAW, if an attack brings you below zero hit points, it not only knocks you unconscious but also inflicts an automatic failed death save from that same attack.

And I to this point was under the idea that the attack that brings you below 0hp as long as it doesn’t also do your max health in damage after the fact then you are simply unconscious. And then all damage received after that inflicts auto fail saves (crits inflicting 2)

Is my interpretation or my dms interpretation correct and is there an official source or creator that has spoken on the matter?

Why do pop up ads automatically download .exe files?

So I was using a movie streaming website, (the ones with all the pop up ads at each click). Usually I just close the ad and nothing happens but recently when the ad pops up a .exe file is downloaded and luckily chrome stopped it as it was labelled dangerous. I’m just curious as to how a file is automatically downloaded without my permission and what I can do to prevent it?

Why is my RADIUS Certificate not automatically signed with the root CA Certificate on my iPhone

I have spent the last few days setting up a freeradius server with eap-tls as the only authentication method. I have used this old tutorial for setting up my own CA and generating the certificates and adjusted the older parameters to match the current ones.

So far I managed to authenticate my iPhone 6 running iOS 11.1.2 as a test device, for that I have:

  • Installed the root CA’s(the one I created) certificate on my iPhone
  • Installed a test identity profile on my iPhone with the name "Test" and test passphrase, which I converted to a .p12 file

Now when I connect to the network with the freeradius server running in debug mode, I can select EAP-TLS as the auth type and tell it to use the identity certificate. It then prompts me to trust the server’s certificate and I get a successful connection.

I have 2 questions:

  1. Why do I need to trust the server’s certificate if I have the root CA’s certificate installed? As far as I understood the way the authentication works is as follows:
  • The server and client each send their respective certificate for the other party to authenticate with the root CA’s certificate. After both are completed there is an optional challenge for the client to complete? (I’m not sure about this) and the client is authenticated

  • The server doesn’t need to be told to explicitly trust the client certificate but the client needs to explicitly trust the server’s even though they are both issued and signed by the same root CA and both parties have the certificate needed to be able to verify it

  • AFAIK the whole point of certificate-based authentication is to prevent MiTM attacks that other methods are vulnerable against. If the user initially connects to a spoofed access-point and accepts that certificate it will refuse the correct RADIUS server and leak the client certificate to the wrong server, this would be avoided if the client can verify the server certificate on its own without user intervention

  1. There is a username option when selecting the network on the iPhone, which does get matched against a backend SQL database by the freeradius server regardless of that username existing the server accepts the authentication. This page notes that the username is used in inner and outer authentication but to me, that doesn’t seem to make sense as there is no inner and outer identity in EAP-TLS. I assume there is a way to tell the radius server to only accept requests that match a username in the database but if it is not configured that way by default what is the point? Doesn’t the certificate already uniquely identify the device/user and what is the point of the username field if anything can be entered?

I would appreciate an explanation to these concepts, I’m relatively new to certificate-based authentication and RADIUS in general so I’m still learning the basics.

The goal of this endeavor is to deploy the server in an eduroam-like environment where users can generate certificates for their devices on some website, download the two needed certificates and get access without having to trust another.

I should also note that I have complete access and control over the server and my CA so I can modify anything as needed, so no quirky workarounds here.

Applying “principle of least privilege” when it comes to execs and owners of the company – should they automatically get all permissions if requested?

As an administrator of certain systems in a company I understand and adhere to the “principle of least privilege” — which I’m assuming I don’t need to repeat its definition here, so let’s just say people here get given access to systems only in accordance with what they need for their role and no more. I follow that principle and check carefully whether they can have read-only access in order to carry out the role and if so I give read access only, etc.

I had a request from an executive-level (C-suite) person (“Jack”, let’s say) who is actually one of the five co-owners of the company, to get blanket “sysadmin” level access to a particular system. (I am confident the request has come from Jack himself and isn’t a hacking or phishing attempt, as I verified it with Jack directly.)

Jack is far too important and involved with strategic stuff to need to carry out any day-to-day work with this system, especially anything that would need sysadmin level access, but occasionally wants to get involved in “poking around” in there, as he is technical by background.

I get the sense that he doesn’t like the idea that he is “walled off” from some system although he owns part of the company.

I’m not asking about the interpersonal aspects about this, just the info-sec ones.

Is it accepted info-sec practice to give an owner of the company “sysadmin” access and by doing bypass the “principle of least privilege”? — since, after all, Jack (partly) owns the company so it’s all his stuff anyway!

Or should that still apply, and even the CEO shouldn’t have write-access to a system when they don’t need it as part of their job function?

Do monsters with the “Telepathy” language automatically sense creatures in their telepathic radius?

Some monsters possess the special “Telepathy” language.

Telepathy Telepathy is a magical ability that allows a monster to communicate mentally with another creature within a specified range. The contacted creature doesn’t need to share a language with the monster to communicate in this way with it, but it must be able to understand at least one language. A creature without telepathy can receive and respond to telepathic messages but can’t initiate or terminate a telepathic conversation.

A telepathic monster doesn’t need to see a contacted creature and can end the telepathic contact at any time. The contact is broken as soon as the two creatures are no longer within range of each other or if the telepathic monster contacts a different creature within range. A telepathic monster can initiate or terminate a telepathic conversation without using an action, but while the monster is incapacitated, it can’t initiate telepathic contact, and any current contact is terminated. (MM p.9)

Does this ability allow them to sense the position of all creatures within the radius of their telepathy, given that “A telepathic monster doesn’t need to see a contacted creature”?

Why are column store indexes disabled automatically when a database is restored?

I have recently done a server migration where we backed up and restored all the databases from a SQL Server 2012 version to SQL Server 2019. However the restored databases appear to all have their column store indexes disabled by default.

Is this expected behaviour? If so, why?

These are archive databases used for selects only, rebuilding every clustered index is going to take a significant amount of time. Any other options?

(sorry, I asked this in the wrong place here. Can that question be removed?)

Is there any way for a character to create a magical disguise that wouldn’t be automatically defeated by a creature with Truesight?

I’m attempting to come up with a solution to the question in the title, but have been unsuccessful thus far.

Some monsters have the Truesight ability which states the following (emphasis mine):

A monster with truesight can, out to a specific range, see in normal and magical darkness, see invisible creatures and objects, automatically detect visual illusions and succeed on saving throws against them, and perceive the original form of a shapechanger or a creature that is transformed by magic. Furthermore, the monster can see into the Ethereal Plane within the same range.

This seems like it’d be nearly impossible to utilize any kind of magical disguise against this creature, however a means to thwart players’ using Truesight would be to rely on additional coverage via the Nondetection spell, which says:

For the duration, you hide a target that you touch from divination magic. The target can be a willing creature or a place or an object no larger than 10 feet in any dimension. The target can’t be targeted by any divination magic or perceived through magical scrying sensors.

and Alter Self’s Change Shape option, which says:

You transform your appearance. You decide what you look like, including your height, weight, facial features, sound of your voice, hair length, coloration, and distinguishing characteristics, if any. You can make yourself appear as a member of another race, though none of your statistics change.


As written, this spell combination would defeat players taking advantage of True Seeing spells. However, monsters do not follow the same rules as players, so I don’t think this would work if the players were to attempt to deceive a monster with the True Sight sense as the ability is not inherently divination magic (to my knowledge).

My question is twofold. Are there any rules which specifically state that the monster True Sight ability is considered a magical divination effect that could be countered by Nondetection? If not, is there another combination of spells that could be used to counter a monsters’ True Sight ability for the purposes of effectively passing off a magical disguise?

Automatically Switch between two AdSense accounts based on the author post

We are two managers for one website , each of us have an AdSense account

Can our ad code display in the articles we write, based on the author slug or id?

I tried to use this code in head section , but it did not work :

<?php if (is_author('author 1');) : ?> <script data-ad-client="ca-pub-ءءءءء1ءءءء" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>; <?php else : ?> <script data-ad-client="ca-pub-ءءءءء2ءءءء" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <?php endif; ?>

any ideas to switch automatically between the accounts, not as a revenue share.