$wpdb update query in plugin only updating one column

I had to use two separate queries. The $wpdb->update syntax cant deal with calculating based on the existing value. But for the other two fields it works. So like this: $table = $wpdb->prefix . ‘woocommerce_downloadable_product_permissions’; $expiry_date = date(“Y-m-d”, strtotime(“+ 30 days”)); $expiry_time = $expiry_date . ‘ 00:00:00’; $wpdb->query(“UPDATE $table SET download_count = (download_count + 1) … Read more

Image change on hover

This isn’t really a WordPress-specific question, but generally you can do something like this via CSS (depending on the structure of the image). Generally, you’ll have an easier time doing this if the image in question is being applied as a background image to a DIV, rather than as just a standard img tag. Then, … Read more

Is it possible for a plugin to force reading and writing of uploaded images to a database instead of to a filesystem?

Yes, you should have quite reasonable options to customize upload, there are plenty of existing solutions around. As for specifics I am not sure on “database” as image storage option. They typical solutions that I’ve heard of are: dedicated location behind CDN (or some variation of); dedicated image storage service, such as Amazon S3.

Invalid plugin installation directory, Google Analytics [closed]

If you rename the plugins folder googleanalytics into something else, e.g. OLDgoogleanalytics then refresh your website, the error is gone. Now you can access your backend plugins page (optional: rename the folder OLDgoogleanalytics back to googleanalytics) and you can see that trying to enable the Google Analytics plugin gives the error you mentioned. I temporarily … Read more

Fatal error in form display plugin

The mistake I was doing was defining scope for $wpdb. The correct script looks something like this: <?php /* Plugin Name: Xenon-Result Plugin URI: https://developer.wordpress.org/plugins/the-basics/ Description: Basic result display plugin. Version: 1.0 Author: Himanshu Gupta Author URI: https://developer.wordpress.org/ License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html */ function installer(){ include(‘installer.php’); } register_activation_hook( __file__, ‘installer’ ); //executes installer php … Read more

Custom license for WordPress plugin

In my opinion this is impossible, while keeping plugin GPL-compatible (which is considered cultural norm for WP extensions, legal claims aside for now). Much of open source licensing in general is to accommodate concept of derivative work. That is for it to really be open source other should be allowed to change it. If they … Read more

dbDelta not adding additional columns in plugin database update

After trial and error, here is the code that works: function installer(){ include(‘installer.php’); } register_activation_hook( __file__, ‘installer’ ); //executes installer php when installing plugin to create new database //database update checkdate function myplugin_update_db_check() { global $xenon_result_db_version; if ( get_option( ‘xenon_result_db_version’ ) != $xenon_result_db_version ) { installer(); } } add_action( ‘plugins_loaded’, ‘myplugin_update_db_check’ ); The installer.php looks … Read more