Skip to content

Instantly share code, notes, and snippets.

View gicolek's full-sized avatar

Rafał Gicgier - Certified Codeable Expert Developer gicolek

View GitHub Profile
@gicolek
gicolek / gf_rp_sc.php
Created May 15, 2015 11:16
Gravity Forms Password Recovery Shortcode
<?php
add_shortcode( 'verify_user_pass', 'wp_doin_verify_user_pass' );
/**
* Shortcode which is used to cover Gravity Forms shortcode. It will not render the password
* reset form in case of invalid pass.
*
* @shortcode verify user pass
*/
@gicolek
gicolek / gf_rp_ih.php
Created May 15, 2015 11:09
Gravity Forms Password Recovery init hook
<?php
add_action( 'init', 'wp_doin_verify_user_key', 999 );
/**
* Check if the user has hit the proper rest password page. The check is identical to that
* from wp-login.php, hence extra $_GET['method'] parameter was included to exclude redirects
* from wp-login.php file on standard password reset method.
*
* @hook wp_head
@gicolek
gicolek / gf_rp_sh_o.php
Last active February 26, 2018 19:58
Gravity Forms Recover Password Submission Hook 1
<?php
add_action( "gform_pre_submission_2", "wp_doin_pre_submission_2" );
/**
*
* @param type $form
* @return type
*/
function wp_doin_pre_submission_2($form) {
@gicolek
gicolek / gf_rp_validation.php
Last active February 13, 2020 07:54
Gravity Forms Recover Password Validation
<?php
// remember, the hook suffix, should contain the form id!
add_filter( "gform_field_validation_2", 'wp_doin_validation_2', 10, 4 );
/**
* Let's verify for the user email or username provided
*
* @return ARRAY_A
*/
function wp_doin_validation_2($result, $value, $form, $field) {
@gicolek
gicolek / gf_confirmation_hook.php
Created March 4, 2015 15:54
Hook Gravity Forms confirmation and redirect the user - http://wp-doin.com
<?php
add_filter( "gform_confirmation_3", "cc_confirmation_redirect_1_3", 3, 4 );
/**
* Redirect the visitor on successful form submission
* @hook gform_confirmation
*/
function cc_confirmation_redirect_1_3($confirmation, $form, $lead, $ajax) {
@gicolek
gicolek / whitelist_hook.php
Created March 4, 2015 15:50
Whitelist redirect allowed hosts - http://wp-doin.com
<?php
add_filter( 'allowed_redirect_hosts', 'wp_doin_allowed_redirect_hosts', 10 );
/**
* Make sure that external host is allowed
* @hook allowed_redirect_hosts
*/
function wp_doin_allowed_redirect_hosts($content) {
$content[] = 'http://example.com';
@gicolek
gicolek / gf_custom_chckb.php
Created February 23, 2015 22:14
Gravity Forms Custom Checkbox Input layout
<?php
add_filter( "gform_field_input", "checkbox_input", 10, 5 );
/**
* Filter the input to be a differently structured checkbox input
*
* @hook gform_field_input
*/
function checkbox_input($input, $field, $value, $lead_id, $form_id) {
@gicolek
gicolek / hosts
Created February 12, 2015 14:25
Win 7 Vagrant hosts file
192.168.50.4 vvv # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 sobel.dev # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 supply.dev # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 test.dev # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 vvv.dev # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 local.wordpress.dev # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 local.wordpress-trunk.dev # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 src.wordpress-develop.dev # VAGRANT: 261e6769cd1d45a39a0beee72dc0fb96 (default) / 79059bfa-4f34-49c6-bfcb-5d27a0c1c466
192.168.50.4 build.wordpress-develop.dev #
@gicolek
gicolek / wp_cli_enable
Created January 25, 2015 23:35
wp-cli enable plugins and theme
wp plugin activate --all
wp theme activate {name_of_our_theme}
@gicolek
gicolek / wp_cli_site_setup
Created January 25, 2015 23:30
Quick site setup WP-CLI
cd d:
cd xampp
cd htdocs
mkdir test_site
cd test_site
git clone git_repo_url.git
wp core download --allow-root
wp core config --dbname="test" --dbuser=wp --dbpass=wp --dbhost="localhost" --allow-root
wp core install --url=test.dev --title="test - A WordPress Site" --admin_user=admin --admin_password=password [email protected] --allow-root