This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Create these triggers to allow OJS user login with his or her email instead of his username | |
-- (OJS controllers do not allow this feature, thus it can be implemented at database level) | |
-- | |
DELIMITER $$ | |
CREATE TRIGGER `update_username` BEFORE INSERT ON `users` FOR EACH ROW begin | |
set new.username = new.email; | |
end | |
$$ | |
DELIMITER ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Intended to run on command line. Outputs csv(;) | |
* Redirect output to file and attach to email, or save | |
* in folder. | |
* Minimum stock is saved (per product) as a product feature. | |
* You must specify feature id | |
*/ | |
define('DB_HOST', 'your-host'); | |
define('DB_USERNAME', 'your-username'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
if ( 'free_shipping' === $rate->method_id ) { | |
$free[ $rate_id ] = $rate; | |
break; | |
} | |
} | |
foreach ( $rates as $rate_id => $rate ) { |