-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from katzwebservices/separate-lead-creator
* Separated Change Lead creator feature into a separate, packaged plugin. This will allow you to enable or disable the functionality. * Added a new filter (`kws_gf_entry_creator_users`) for the Entry to be able to specify what users appear in the dropdown (as an array of `WP_User` objects). If no users are specified,
- Loading branch information
Showing
2 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,57 @@ | ||
<?php | ||
/* | ||
Change Entry Creator Gravity Forms Add-on | ||
This simple addon allows users with Entry-editing capabilities to change who a lead is assigned to. | ||
Version: 1.0 | ||
Plugin Name: Gravity Forms Change Entry Creator Add-on | ||
Plugin URI: http://katz.co/gravity-forms-addons/ | ||
Description: This simple addon allows users with Entry-editing capabilities to change who a <a href="http://katz.si/gravityforms" rel="nofollow">Gravity Forms</a> lead is assigned to. | ||
Author: Katz Web Services, Inc. | ||
Version: 3.5.3 | ||
Author URI: http://www.katzwebservices.com | ||
Copyright 2014 Katz Web Services, Inc. (email: [email protected]) | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
add_action("gform_entry_info", 'kws_gf_change_entry_creator_form', 10, 2); | ||
|
||
// If this is already custom-added from katz.co | ||
if(!function_exists('kws_gf_change_entry_creator_form')) { | ||
function kws_gf_change_entry_creator_form($form_id, $lead) { | ||
if(GFCommon::current_user_can_any("gravityforms_edit_entries")) { | ||
$users = get_users(); | ||
|
||
//@since 3.5.3 - filter possible creators | ||
$users = apply_filters( 'kws_gf_entry_creator_users', '', $form_id ); | ||
|
||
if( empty( $users ) ) { | ||
$users = get_users(); | ||
} | ||
|
||
$output = '<label for="change_created_by">'; | ||
$output .= __('Change Entry Creator:', 'gravity-forms-addons'); | ||
$output .= '</label> | ||
<select name="created_by" id="change_created_by" class="widefat">'; | ||
foreach($users as $user) { | ||
$output .= '<option value="'.$user->ID.'"'.selected((int)$lead["created_by"] === (int)$user->ID, true, false).'>'.$user->display_name.' ('.$user->user_nicename.')</option>'; | ||
$output .= '<option value="'. $user->ID .'"'. selected( $lead['created_by'], $user->ID, false ).'>'.$user->display_name.' ('.$user->user_nicename.')</option>'; | ||
} | ||
$output .= '</select>'; | ||
$output .= '<input name="originally_created_by" value="'.$lead['created_by'].'" type="hidden" />'; | ||
echo $output; | ||
} | ||
} | ||
} | ||
} | ||
|
||
add_action("gform_after_update_entry", 'kws_gf_update_entry_creator', 10, 2); | ||
if(!function_exists('kws_gf_update_entry_creator')) { | ||
|
@@ -47,4 +73,4 @@ function kws_gf_update_entry_creator($form, $leadid) { | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
Plugin URI: http://katz.co/gravity-forms-addons/ | ||
Description: Turn <a href="http://katz.si/gravityforms" rel="nofollow">Gravity Forms</a> into a great WordPress directory...and more! | ||
Author: Katz Web Services, Inc. | ||
Version: 3.5.2 | ||
Version: 3.5.3 | ||
Author URI: http://www.katzwebservices.com | ||
Copyright 2013 Katz Web Services, Inc. (email: [email protected]) | ||
|
@@ -32,7 +32,7 @@ class GFDirectory { | |
|
||
private static $path = "gravity-forms-addons/gravity-forms-addons.php"; | ||
private static $slug = "gravity-forms-addons"; | ||
private static $version = "3.5.2"; | ||
private static $version = "3.5.3"; | ||
private static $min_gravityforms_version = "1.5"; | ||
|
||
public static function directory_defaults($args = array()) { | ||
|