Skip to content

Instantly share code, notes, and snippets.

View luistinygod's full-sized avatar
🎯
Focusing

Luis Godinho luistinygod

🎯
Focusing
  • Porto, Portugal
View GitHub Profile
@luistinygod
luistinygod / gravityview-required-search-fields.php
Last active August 29, 2015 14:08
GravityView Make (some) Search Fields Required
<?php
/**
* If you need to make some of the GravityView search fields required before search is submited
* - add as many lines as you need to define which fields are required
* e.g. -> jQuery('#gv_search_XYZZ').prop('required', true );
*
* Add this gist to your theme functions.php
*
*/
@luistinygod
luistinygod / gv-custom-required-search-fields.php
Last active August 29, 2015 14:08
GravityView Make (some) Search Fields Required (custom plugin)
<?php
/*
Plugin Name: GravityView - Custom Required Search Fields
Plugin URI: https://gravityview.co/
Description: Custom Add-on to make certain GravityView Search fields required before performing the search
Author: Katz Web Services, Inc.
Version: 1.0.0
Author URI: http://www.katzwebservices.com
Copyright 2014 Katz Web Services, Inc. (email: info@katzwebservices.com)
@luistinygod
luistinygod / gv-custom-role-filter.php
Last active October 29, 2021 12:09
GravityView extend the Advanced Filter to a certain users' role
<?php
/**
* When using the Advanced Filter extension to filter entries to show just the ones created by the user logged-in
* BUT remove the restriction to a certain role of users ( administrators or editors )
*
* Replace the following to your own values:
* - REPLACE_BY_VIEW_ID, use the view id where this logic applies
* - REPLACE_BY_THE_ROLE, use 'administrator' or 'editor' or your own custom role
*
@luistinygod
luistinygod / gv-redirect-login-page.php
Created January 9, 2015 17:19
GravityView Force not logged users to login before seeing the single entry view
<?php
/*
Plugin Name: GravityView - force login before single view
Plugin URI: https://gravityview.co/
Description: Redirect visitors to login page before seeing the single entry view
Author: Katz Web Services, Inc.
Version: 1.0.0
Author URI: http://www.katzwebservices.com
Copyright 2015 Katz Web Services, Inc. (email: info@katzwebservices.com)
@luistinygod
luistinygod / gist:e2bc8a6c88b207c4ead4
Created January 12, 2015 19:04
Adds a 'clear' button to your GravityView Search Bar
<?php
/* Add this to your theme's functions.php file */
// Adds a 'clear' button to your GravityView Search Bar
add_action( 'gravityview_search_widget_fields_after', 'my_gv_clear_search_button' );
function my_gv_clear_search_button() {
$url = strtok( add_query_arg( array() ), '?' );
?>
<a href="<?php echo esc_url( $url ); ?>" class="button gv-search-button">Clear</a>
<?php
@luistinygod
luistinygod / gist:9dcb82e1eed60ee7e4b1
Last active August 29, 2015 14:14
Force GravityView search to be exact for a certain field (Operator 'is' instead of 'like')
<?php
/**
* Place this in your theme's functions.php
* Please adapt the form_id and the field key to your own case.
* This is intended to force GravityView to search for the exact value instead of be more relaxed (default search uses operator LIKE)
*
*/
add_filter( 'gravityview_fe_search_criteria', 'my_gv_exact_search', 20, 2 );
@luistinygod
luistinygod / gist:8d9ded0fbdc0d16a4f29
Created January 29, 2015 15:38
GravityView: Do not allow to edit a field if the field has a specific value
<?php
/**
* Do not allow a certain user to edit a field if that field has a specific value
*
* Replace the following to your own values:
* - REPLACE_BY_FORM_ID, use the form id where this logic applies
* - REPLACE_BY_FIELD_ID, use the field id where this logic applies
*
*
@luistinygod
luistinygod / gist:0d49b2b0f530f6c6fce1
Created February 13, 2015 11:47
GravityView: How to change the Search Entries label on the Search Widget
<?php
/*
* Supported on GravityView 1.6
*
* Add this to your theme's functions.php file
*
* Replace the string 'MY NEW LABEL' for your own
*/
@luistinygod
luistinygod / gist:9dce30ca1fd146dd31bc
Last active May 1, 2020 16:13
GravityView: Removes Custom Content field content in case a certain entry's field is empty
<?php
/** Modify the content returned from the Custom Content field */
add_filter( 'gravityview/fields/custom/content_before', 'my_gv_custom_content_before', 10, 1 );
/**
* Removes the custom content field's content in case a certain entry field is empty
* Replace the MY_FIELD_ID by the field id (check it on the Gravity Forms form definition)
*
* @param string $content Custom Content field content
* @return string
@luistinygod
luistinygod / gf-mailchimp-export-edit-entry.php
Created March 2, 2015 12:34
GravityView: Custom plugin to force updated entries to be exported with the GF MailChimp add-on
<?php
/*
Plugin Name: Gravity Forms MailChimp Custom Export
Plugin URI: http://gravityview.co/
Description: Custom plugin to force updated entries to be exported with the GF MailChimp add-on
Author: Katz Web Services, Inc.
Version: 1.1.0
Author URI: http://www.katzwebservices.com
Copyright 2014 Katz Web Services, Inc. (email: info@katzwebservices.com)