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_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
@gicolek
gicolek / wp_cli
Created January 25, 2015 22:53
WP-CLI list users
wp user list
@gicolek
gicolek / gf_validate_edit_account.php
Last active June 27, 2024 12:23
GF Validate Field Hook for
<?php
// change the number suffix to the one corresponding to your form and field's id!
add_filter( 'gform_field_validation_1_1', 'wp_doin_validate_password_field', 10, 4 );
/**
* @hook gform_field_validation_4
*
* This function is assigned to the old password field, and then iterates over all form fields
* if it hits a field with the pass-confirm class assigned it then compares it's value
@gicolek
gicolek / gf_pre_submission_edit_acc.php
Last active June 27, 2024 12:21
Gravity Forms Pre Submission Hook for
<?php
// make sure to change 5he prefix to the one you are using with your forms
add_action( "gform_pre_submission_4", "wp_doin_edit_pre_submission" );
/**
* @hook gform_pre_submission_4
*/
function wp_doin_edit_pre_submission( $form ) {