Updating CiviCRM on WordPress

There are several steps when wanting to upgrade your CiviCRM install on WordPress. The official guide is here:
https://docs.civicrm.org/sysadmin/en/latest/upgrade/wordpress/

This is my simplified quick steps that work for me…

(1) Open browser and login to your CiviCRM install. Keep browser open during this entire process.

(2) Download most recent version of CiviCRM https://civicrm.org/download for WordPress onto your computer, and extract the civicrm folder from the zip/tar file.

(3) On your server, rename the /wp-content/plugins/civicrm folder to /wp-content/plugins/civicrmOLD

(4) On your server, move the /wp-content/plugins/civicrmOLD to /wp-content/civicrmOLD

(5) Upload the civicrm folder from your computer to your server into the /wp-content/plugins/ directory.

(6) Delete all the files in /wp-content/uploads/cicvcrm/templates_c/ directory.

(7) From browser, go to http://example.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/upgrade&reset=1 to start the database upgrade.

(8) After complete, check that CivicCRM is working properly, and if it is you can then delete /wp-content/civicrmOLD folder and files.

Google Drive restricted file sharing still creates publicly accessible link – This is a critical security issue

I have come across a critical security issue with Google Drive file sharing.

When you set file sharing to “Restricted – Only people added can open with this link” then only people that you have specifically added should be able to view the document and they should be forced to login before they can view the document.

However, if you share the Restricted file with a non-Google email, you will get a poorly worded popup that asks you if you want to Share Anyway:

What is very unclear, is that if you click on Share Anyway, then a publicly accessible link is created that anybody can use to view the file now, even without logging in to Google.

And what is worse, is that the file status still shows as “Restricted: Only people added can open with this link” when in reality the file status should be changed to “Anyone with the link can view the file”.

This is a Critical Security issue.

When a file is set to RESTRICTED, it should only be viewable by those added that have a Google account to login with first, and should NEVER be viewable by anybody else even if they have the link.

Another -1 for Google 🙁

Here is thread on Stackoverflow:
https://stackoverflow.com/questions/71130234/critical-security-issue-with-google-drive-when-sharing-file-as-restricted

Here is a link on the Google Issue Tracker:
https://issuetracker.google.com/issues/215152601

Importing WooCommerce products into WordPress with custom fields and multiple product categories

If you are trying to import products into WooCommerce that have custom fields, you can try the Really Simple CSV Importer plugin and follow my instructions below.

Note that the Really Simple CSV Importer plugin v1.3 has not been updated for years, however it still works fine as of WordPress v5.8 for importing WooCommerce products.
In order to use it, you go to TOOLS then IMPORT and you will see it in the list import tools to choose from.

Some caveats with Really Simple CSV Importer plugin:
– The CSV file needs to be UTF-8.
– The header row of CSV file should NOT have double-quotes around each field.
– Each row in the CSV file (except the header row) should have double-quotes around each field.
– Each field in each row must use a comma as the seperator.
– To import to a custom field (meta field) called my_custom_field just use that exact name in the header row field name.
– To import to a hidden custom field called (hidden meta field) _my_custom_hidden_field you need to put an _underscore_ in front of the header row field name.
– It appears that post_id and post_name are required in the header row fields, but you can leave them blank and they will be automatically be generated.
– post_category generates a category under POSTS instead of PRODUCTS, so leave post_category blank.
– To import to a woocommerce specific custom field, you can use the following in the header row fields (these are just some of them):
  For REGULAR PRICE use: _regular_price
  For SALE PRICE use: _sale_price
  For the displayed PRICE use: _price
  For SKU use: _sku
  For STOCK MANAGEMENT (yes or no) use: _manage_stock
  For STOCK QUANTITY use: _stock
  For PRODUCT CATEGORY use (can only specify a single category): tax_product_cat
  For PRODUCT TYPE use (simple): tax_product_type
  For SHOP CATALOG or SEARCH visibility use (can specify one of exclude-from-search or exclude-from-catalog): tax_product_visibility

Here is a sample CSV file you can copy and paste:

post_id,post_name,post_title,post_content,post_author,post_date,post_tags,post_category,post_thumbnail,post_type,post_status,_sku,_regular_price,_price,_stock,_manage_stock,_visibility,tax_product_visibility,tax_product_type,tax_product_cat,_custom_field_hidden,custom_field_meta
"","my-first-product-url-slug","My first product name","description","","","","","https://mywordpresssite.com/wp-content/uploads/first-product-featured-image.jpg","product","publish","first-product-sku","50","50","3","yes","hidden","exclude-from-search","simple","my-product-category","hidden meta field","meta field"
"","my-second-product-url","My second product name","description","","","","","https://mywordpresssite.com/wp-content/uploads/second-product-featured-image.jpg","product","publish","second-product-sku","20","20","4","yes","hidden","exclude-from-catalog","simple","another-product-category","hidden meta field","meta field"

MODIFICATIONS TO CODE
I have created a couple modifications to the Really Simple CSV Importer code that will allow the following:
– Add multiple product categories seperated by the pipe | character: “my-product-cat|another-product-cat”
– Add both product visibility options seperated by the pipe | character: “exclude-from-catalog|exclude-from-search”
– Add a new header row option called “tax_search_exclude” which will allow you use the SEARCH EXCLUDE plugin: “yes”
NOTE: The exclude-from-search option will only hide products from the WooCommerce search but not from the WordPress search. In order to also hide products from the WordPress search, you need to use the SEARCH EXCLUDE plugin https://wordpress.org/plugins/search-exclude/

In order to make these modifications work, you need to modify the following file around line 289: class-rscsv_import_post_helper.php

Look for this code:

public function setObjectTerms($taxonomy, $terms)
{
$post = $this->getPost();

And replace with this code:

public function setObjectTerms($taxonomy, $terms)
{

//// MOD by jsherk //////////////////////////////////////////////////////////////////////////////////////

////////////// MULTIPLE terms for a TAXONOMY
// Check if taxonomy has more than one term (use | to specify multiple terms).
// For example import "tax_product_cat" as: "myCategory1|anotherCategory2" to add it to two categories.
// For example import "tax_product_visibility" as: "exclude-from-search|exclude-from-catalog" to hide from both shop catalog and search
$new_terms = array();
foreach ($terms as $term) {
$terms_split = false;
if (strpos($term, "|") == true ) {
$terms_split = true; // Yes the term contained multiple terms seperated by the pipe| character.
$split_terms = explode("|", $term);
foreach ($split_terms as $split_term ) {
// Add each split as a seperate term
$new_terms[] = $split_term;
}
}
if ($terms_split == false) {
// No the term did not contain multiple terms.
$new_terms[] = $term;
}
}
$terms = $new_terms; // Replace orignal terms with split up terms
//////////////

////////////// SEARCH EXCLUDE PLUGIN https://wordpress.org/plugins/search-exclude/
// If you use a plugin called SEARCH EXCLUDE then we need to create an OPTION instead of a TAXONOMY.
// In the csv file, use a csv header of "tax_search_exclude" and then set a value of either "yes" or "no". If the value is "yes" then we will add the option to the options table.
if ($taxonomy == "search_exclude") {
if (strtolower($terms[0]) == "yes") {
$server_path_array = explode("wp-content", __FILE__);
$server_path = $server_path_array[0];
$wp_load = $server_path.'wp-load.php';
require_once( $wp_load );
$wp_option = $server_path.'wp-includes/option.php';
require_once($wp_option);
$post = $this->getPost();
$new_option_id = intval($post->ID); // get the post_id
$search_exclude_options = get_option("sep_exclude"); // read the current values from the options table
if (empty($search_exclude_options)) {
// if the option is empty, then it does not exist and needs to be added
$new_search_exclude_option = array($new_option_id);
delete_option("sep_exclude"); // option may exist but be empty so we need to delete it first otherwise add_option will not update (add_option will only work if the option does not exist at all).
add_option("sep_exclude", $new_search_exclude_option, " ", "yes");
} else {
$search_exclude_options[] = $new_option_id;
update_option("sep_exclude", $search_exclude_options);
}
$search_exclude_options = get_option("sep_exclude"); // re-read the current values from the options table
}
}
//////////////

//// end MOD by jsherk //////////////////////////////////////////////////////////////////////////////////////

$post = $this->getPost();

Here is a sample CSV file with MODIFICATIONS you can copy and paste:

post_id,post_name,post_title,post_content,post_author,post_date,post_tags,post_category,post_thumbnail,post_type,post_status,_sku,_regular_price,_price,_stock,_manage_stock,_visibility,tax_search_exclude,tax_product_visibility,tax_product_type,tax_product_cat,_custom_field_hidden,custom_field_meta
"","my-first-product-url-slug","My first product name","description","","","","","https://mywordpresssite.com/wp-content/uploads/first-product-featured-image.jpg","product","publish","first-product-sku","50","50","3","yes","hidden","yes","exclude-from-search|exclude-from-catalog","simple","my-product-category|another-product-category","hidden meta field","meta field"
"","my-second-product-url","My second product name","description","","","","","https://mywordpresssite.com/wp-content/uploads/second-product-featured-image.jpg","product","publish","second-product-sku","20","20","4","yes","hidden","no","exclude-from-catalog","simple","another-product-category","hidden meta field","meta field"

Simple POS setup for WooCommerce – Point Of Sale plugins for WordPress

I was looking for a simple Point Of Sale (POS) solution that would allow me to take in-person Cash payments as well as Credit Card payments for my WooCommerce store.

There are several free POS plugins available that allow Cash payments, but you need to pay for the Pro versions if you also want to take Credit Cards as well.

There are also several free POS plugins that will allow you to take both Cash and Credit Card payments, but you need to use their credit processor and not your own.

The following is a very simple POS setup that will allow you to take both Cash payments on your WooCommerce store, as well as Credit Card payments using whatever credit card processor and gateway you already have setup.

There are a few issues that you need to be aware of if you are going to use this method:
(1) This setup assumes that you are currently NOT using the Cash On Delivery payment method in WooCommerce. If you are already using this payment method, then this setup will not work for you.
(2) This method will not calculate change due from cash tendered. You will manually need to do this.
(3) With this method, you can not split a payment as partial cash and partial credit card. It needs to be all cash or all credit card.

If those issues are not a problem for you, then below are the steps you need to set it up and make it work for you.

In summary, what we are going to do is add a new user with a new/unique user role called SHOP CASHIER. We will then make the Cash On Delivery method availble during the checkout process, but only if this user with SHOP CASHIER role is logged in. If any other user is logged in, or if no user is logged in, then the Cash On Delivery method will not be available.

STEP 1 – Install and Activate plugins
Install and activate the following two plugins:
Members (MemberPress) https://wordpress.org/plugins/members/
Payment Gateways by User Roles for WooCommerce (Imaginate Solutions) https://wordpress.org/plugins/payment-gateways-by-user-roles-for-woocommerce/

STEP 2 – Create a new role
Go to Members tab then to Roles.
Look for the Subscriber role, and click on CLONE.
Change the Cloned Role name to something like “SHOP CASHIER” and click on ADD ROLE.
NOTE: You can actually clone any role you want, but I chose the Subscriber role because my Shop Cashier does not need to access anything else within WordPress.
NOTE: The Members plugin has a setting (which is ON by default) that will allow you to assign multiple roles to the same user. You can disable this if would prefer to leave it the WordPress default way, where they can only be assigned a single role at a time.

STEP 3 – Add a new user with new role
Go to Users tab and then Add New.
Create a new user and assign them the new role of SHOP CASHIER and click ADD NEW USER.

STEP 4 – Set CASH ON DELIVERY as only availble to new role
Go to WooCommerce tab then to Settings then to Payment Gateways By User Roles.
Under the CASH ON DELIVERY method, click in the INCLUDE USER ROLES box and select the SHOP CASHIER role.
Scroll to bottom and click on SAVE CHANGES.

STEP 5 – Activate the Cash On Delivery payment method
Go to WooCommerce tab then to Settings then to Payments.
Click on the Set Up/Manage button for the Cash On Delivery method.
Check the box to ENABLE this method.
Set the title to something like: CASH
Set the description to something like: When customer has PAID in FULL with cash, click on PLACE ORDER.
Set the instructions to something like: Pay with cash, in-person.
Click on SAVE CHANGES.

STEP 6 – Test your changes
Now to test your setup, log out from WordPress and go to your WooCommerce store and add a product to your cart and the proceed to checkout.
Since you are logged out, you should NOT see the CASH method available. Only the regular payments methods that are normally available to your customers should be availble.
You can also try to login with any user except the new SHOP CASHIER user. When you log in with any other except the SHOP CASHIER user, you should still NOT see the CASH method available.
Now finally you want to login with the SHOP CASHIER user. When you proceed to checkout, you should now see the option for CASH available along with all your other regular payment methods, so you will be able to accept in-person cash payments as well as your any of your other payment methods.

How to convert Presearch tokens (PRE) to ETH (or BTC or cash) – PRE tokens

Presearch is working on a decentralized search engine: https://presearch.io/

Their crypto currency token is PRE

I have built up some PRE by using their search engine, and wanted to cash them out but found the process was not very easy because many exchanges do not accept PRE and therefore won’t exchanage it. So it took me several days to figure out how to do it.

STEP 1
Follow Presearchs own instruction by creating a wallet with My Ether Wallet (https://www.myetherwallet.com) and withdraw your tokens and send them to your new MEW wallet.

STEP 2
In order to exchange your PRE for something else, you will need to have some ETH in your MEW wallet to pay for the gas.
I found .005 ETH was a good minimum number.
You will need to purchase the ETH on another exchange and then send it to your MEW wallet.

STEP 3
You can then use CoinGetCoin to make the exchange (https://coingetcoin.com/#how-it-works).
You tell it how many PRE you will send, and it will tell you how many ETH you will get back.
I like this platform because you just send the PRE and it will automatically send ETH back to your wallet.
Specify the approximate amount of PRE you are going to send (does not need to be exact), and then specify the wallet address where you want the ETH sent after the exchange (I just sent it back to my MEW wallet).
CoinGetCoin will then give you a wallet address and you have 24 hours to send your PRE.
Be sure to note the minimum PRE that they will accept.

STEP 4
Go back to your MEW wallet and specify the address CoinGetCoin gave you, and send your PRE.
You can go back to CoinGetCoin and it will tell the progress (when it receives your PRE and when it sent the ETH back).
I have made a couple exchanges using CoinGetCoin and it took less than 30 minutes each time.

STEP 5
Now that you have ETH in your My Ether Wallet instead of PRE, you can do what you want with it.
For me, I sent it to my Coinsquare.com account and converted it to dollars and withdrew it to my bank account.

FREE codec for playing HEVC h.265 video on Windows 10

I was having an issue where my Windows 10 computer would not play HEVC h.265 video.

When you try to play the video, Windows Movies & TV app opens, but says it can not play it and that you need to purchase a $0.99 plugin from the Microsoft Store.

But there is actually a FREE version of codec that you can install/launch from the Microsoft Store as well (but of course they do not tell you about it).
Its called:

HEVC Video Extensions from Device Manufacturer
https://www.microsoft.com/en-us/p/hevc-video-extensions-from-device-manufacturer/9n4wgh0z6vhq

Alternate link:
https://www.microsoft.com/en-us/p/hevc-video-extensions-from-device-manufacturer/9n4wgh0z6vhq?irgwc=1&OCID=AID2000142_aff_7593_159229&tduid=%28ir__hwp9gz9pl9kftzgvkk0sohzize2ximz2ee93rrzl00%29%287593%29%28159229%29%28%29%28UUwpUdUnU56887YYwYg%29&irclickid=_hwp9gz9pl9kftzgvkk0sohzize2ximz2ee93rrzl00&activetab=pivot%3Aoverviewtab

Click the link above (its directly on Microsoft.com), choose GET, open the MICROSOFT STORE, choose INSTALL and then choose LAUNCH.
You do NOT need to sign up and do NOT need to create microsoft account to install this codec. Just skip/ignore any of those requests.

After this, try playing your HEVC h.265 videos with Windows Movies & TV app, and they should play!

Per Product Flat Rate Shipping for WooCommerce

Per Product Flat Rate Shipping for WC has just been released!

Set seperate flat-rate shipping costs for both Domestic and International shipping on a per product basis in WooCommerce.

This plugin will allow to set a flat-rate domestic shipping price and also a flat-rate international shipping price for each WooCommerce product that you have.

Find it here: https://wordpress.org/plugins/per-product-flat-rate-shipping-for-wc/