Skip to content

Commit

Permalink
Check for minimum GF version
Browse files Browse the repository at this point in the history
  • Loading branch information
zackkatz committed Jun 24, 2014
1 parent 5c16b6c commit a903d33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
6 changes: 3 additions & 3 deletions gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public static function getInstance() {

public function __construct() {

// If Gravity Forms doesn't exist, load the admin view class to show
// the notice, but not load any post types or process shortcodes.
// If Gravity Forms doesn't exist or is outdated, load the admin view class to
// show the notice, but not load any post types or process shortcodes.
// Without Gravity Forms, there is no GravityView. Beautiful, really.
if(!class_exists('GFForms')) {
if( !class_exists('GFForms') || false === version_compare(GFCommon::$version, '1.8', ">=") ) {
require_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' );
return;
}
Expand Down
9 changes: 8 additions & 1 deletion includes/class-admin-views.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,15 @@ public function check_gravityforms() {

$gf_status = GravityView_Plugin::get_plugin_status( 'gravityforms/gravityforms.php' );

$is_valid_version = version_compare( GFCommon::$version, '1.8', ">=" );

$image = '<img src="'.plugins_url( 'images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignleft" height="87" width="66" alt="The GravityView Astronaut Says:" style="margin:0 10px 10px 0;" />';

if( false === $is_valid_version ) {
$this->admin_notices[] = array( 'class' => 'error', 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version 1.8 or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravity-view' ), '<h3>'.$image, "</h3>\n\n", '<tt>'.GFCommon::$version.'</tt>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>') );
}

if( $gf_status !== true ) {
$image = '<img src="'.plugins_url( 'images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignleft" height="87" width="66" alt="The GravityView Astronaut Says:" style="margin:0 10px 10px 0;" />';
if( $gf_status === 'inactive' ) {
$this->admin_notices[] = array( 'class' => 'error', 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravity-view' ), '<h3>'.$image, "</h3>\n\n".'<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">', '</a></strong>' ) );
} else {
Expand Down
8 changes: 5 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ Beautifully display your Gravity Forms entries.
== Changelog ==

= 1.0.5 =
* Added: Lightbox for images (in View Settings metabox)
* Added: Merge Tags - You can now modify labels and settings using dynamic text based on the value of a field. (requires Gravity Forms 1.8.6 or higher)
* Added: Customize the return to directory link anchor text (in the View Settings metabox, under Single Entry Settings)
* Added: Set the title for the Single Entry
* Added: Choose whether to hide empty fields on a per-View basis
* Improved: DataTables styling now set to `display` by default. Can be overridden by using the filter `gravityview_datatables_table_class`
* Fixed: Approve Entries column not displaying when clicking Forms > Entries link in admin menu
* Fixed: Field Settings gear no longer showing for widgets without options
* Improved: "No Views found" text now more helpful for getting started.
* Improved: Speed!
* Added `form` item to global `$gravityview_view` data instead of looking it up in functions. Improves `gv_value()` and `gv_label()` speed.
* Added `replace_variables()` method to `GravityView_API` to reduce time to process merge tags by checking if there are any curly brackets first.
* Improved: "No Views found" text now more helpful for getting started.
* Fixed: Approve Entries column not displaying when clicking Forms > Entries link in admin menu
* Fixed: Field Settings gear no longer showing for widgets without options
* Fixed: Added Gravity Forms minimum version notice when using < 1.8

= 1.0.4 =
* Added: __DataTables integration__ Created a new view type for existing forms that uses the [DataTables](http://datatables.net) script.
Expand Down

0 comments on commit a903d33

Please sign in to comment.