Skip to content

Instantly share code, notes, and snippets.

View walidmahade's full-sized avatar
🏠
Working from home

Mahade Walid walidmahade

🏠
Working from home
View GitHub Profile
@walidmahade
walidmahade / wc-min-pass-chars-req.php
Created October 31, 2020 12:24 — forked from rynaldos-zz/wc-min-pass-chars-req.php
[WooCommerce 3.0] Require minimum password length for account registration, password update, and password resets
add_action('woocommerce_process_registration_errors', 'validatePasswordReg', 10, 2 );
function validatePasswordReg( $errors, $user ) {
// change value here to set minimum required password chars
if(strlen($_POST['password']) < 15 ) {
$errors->add( 'woocommerce_password_error', __( 'Password must be at least 15 characters long.' ) );
}
// adding ability to set maximum allowed password chars -- uncomment the following two (2) lines to enable that
//elseif (strlen($_POST['password']) > 16 )
//$errors->add( 'woocommerce_password_error', __( 'Password must be shorter than 16 characters.' ) );
@mahlamusa
mahlamusa / extend-wp-rest-api.php
Last active June 1, 2023 10:38
Extend WordPress REST API with custom rest fields and endpoints
<?php
/**
* Register custom rest fields
*/
add_action( 'rest_api_init', 'register_custom_fields' );
/**
* Register rest fields and endpoint
*
@dexit
dexit / vanilla-api.md
Created April 15, 2018 14:09
Building a Simple Web API with Vanilla PHP
anonymous
anonymous / config.json
Created May 10, 2016 18:54
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",