WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Gravity Forms Toolbar

This plugin adds useful admin links and resources for Gravity Forms to the WordPress Toolbar / Admin Bar.

Does this plugin work with newest WP version and also older versions?

Yes, this plugin works really fine with WordPress 3.3 and 3.3.1! It also works great with WP 3.2 - and also should with WP 3.1 - but we only tested extensively with WP 3.3+ this time. So you always should run the latest WordPress version for a lot of reasons.

How are new resources being added to the toolbar / admin bar?

Just drop me a note on my Twitter @deckerweb or via my contact page and I'll add the link(s) if it is useful for admins/ webmasters and the Gravity Forms community.

How could my plugin/extension settings page be added to the admin bar links?

This is possible of course and highly welcomed! Just drop me a note on my Twitter @deckerweb or via my contact page and we sort out the details! Particularly, I need the admin url for the primary options page (like so wp-admin/admin.php?page=foo). I also need the correct name of the main PHP class or function (to check if the plugin extension exists or not). (I don't own all the premium stuff myself yet so you're more than welcomed to help me out with these things. Thank you!)

There are still some other plugins for Gravity Forms out there why aren't these included by default?

Simple answer: Linking/ adding is only possible where a plugin has its own admin pages and these are properly accessable.

Can custom menu items be hooked in via theme or other plugins?

Yes, this is possible since version 1.5 of the plugin! There are 3 action hooks available for hooking custom menu items in -- gftb_custom_main_items for the main section, gftb_custom_extension_items for the exentensions section plus gftb_custom_group_items for the resource group section. Here's an example code:

add_action( 'gftb_custom_group_items', 'gftb_custom_additional_group_item' );
/**
 * Gravity Forms Toolbar: Custom Resource Group Items
 *
 * @global mixed $wp_admin_bar
 */
function gftb_custom_additional_group_item() {

    global $wp_admin_bar;

    $wp_admin_bar->add_menu( array(
        'parent' => 'ddw-gravityforms-gfgroup',
        'id'     => 'your-unique-item-id',
        'title'  => __( 'Custom Menu Item Name', 'your-textdomain' ),
        'href'   => 'http://deckerweb.de/',
        'meta'   => array( 'title' => __( 'Custom Menu Item Name Tooltip', 'your-textdomain' ) )
    ) );
}

Can certain sections be removed?

Of course, just via plugin options! -- Additionally, you can use some constants - which can come in handy for customizing stuff for clients etc. You can remove the following sections: Official "Add-Ons" (all items) / "Extensions" area (all items) / "Resources link group" at the bottom (all items) / "German language stuff" (all items) / "Dutch language stuff" (all items)

To achieve this add one, some or all of the following constants to your theme's/child theme's functions.php file:

/** Gravity Forms Toolbar: Remove Add-On Items */
define( 'GFTB_ADDONS_DISPLAY', FALSE );

/** Gravity Forms Toolbar: Remove Extensions Items */
define( 'GFTB_EXTENSIONS_DISPLAY', FALSE );

/** Gravity Forms Toolbar: Remove Resource Items */
define( 'GFTB_RESOURCES_DISPLAY', FALSE );

/** Gravity Forms Toolbar: Remove German Language Items */
define( 'GFTB_DE_DISPLAY', FALSE );

/** Gravity Forms Toolbar: Remove Dutch Language Items */
define( 'GFTB_NL_DISPLAY', FALSE );

/** Gravity Forms Toolbar: Remove Spanish Language Items */
define( 'GFTB_ES_DISPLAY', FALSE );

Can the the whole toolbar entry be removed, especially for certain users?

Yes, that's also possible! This could be useful if your site has special user roles/capabilities or other settings that are beyond the default WordPress stuff etc. For example: if you want to disable the display of any "Gravity Forms Toolbar" items for all user roles of "Editor" please use this code:

/** Gravity Forms Toolbar: Remove all items for "Editor" user role */
if ( current_user_can( 'editor' ) ) {
    define( 'GFTB_DISPLAY', FALSE );
}

To hide only from the user with a user ID of "2":

/** Gravity Forms Toolbar: Remove all items for user ID 2 */
if ( 2 == get_current_user_id() ) {
    define( 'GFTB_DISPLAY', FALSE );
}

To hide items only in frontend use this code:

/** Gravity Forms Toolbar: Remove all items from frontend */
if ( ! is_admin() ) {
    define( 'GFTB_DISPLAY', FALSE );
}

In general, use this constant do hide any "Gravity Forms Toolbar" items:

/** Gravity Forms Toolbar: Remove all items */
define( 'GFTB_DISPLAY', FALSE );

Available Filters to Customize More Stuff

All filters are listed with the filter name in bold and the below additional info, helper functions (if available) as well as usage examples.

gftb_filter_capability_all

  • Default value: gravityforms_edit_forms (set by Gravity Forms plugin itself!)
  • 6 Predefined helper functions:
    • __gftb_admin_only -- returns 'administrator' role -- usage:
add_filter( 'gftb_filter_capability_all', '__gftb_admin_only' );
  • __gftb_role_editor -- returns 'editor' role -- usage:
add_filter( 'gftb_filter_capability_all', '__gftb_role_editor' );
  • __gftb_cap_manage_options -- returns 'manage_options' capability -- usage:
add_filter( 'gftb_filter_capability_all', '__gftb_cap_manage_options' );
  • __gftb_cap_install_plugins -- returns 'install_plugins' capability -- usage:
add_filter( 'gftb_filter_capability_all', '__gftb_cap_install_plugins' );
  • __gftb_cap_activate_plugins -- returns 'activate_plugins' capability -- usage:
add_filter( 'gftb_filter_capability_all', '__gftb_cap_activate_plugins' );
  • __gftb_cap_edit_theme_options -- returns 'edit_theme_options' capability -- usage:
add_filter( 'gftb_filter_capability_all', '__gftb_cap_edit_theme_options' );
  • Another example:
add_filter( 'gftb_filter_capability_all', 'custom_gftb_capability_all' );
/**
 * Gravity Forms Toolbar: Change Main Capability
 */
function custom_gftb_capability_all() {
    return 'switch_themes';
}

--> Changes the capability to switch_themes

gftb_filter_main_icon

  • Default value: Gravity Forms logo (favicon) :)
  • 10 Predefined helper functions for the 11 included colored icons, returning special colored icon values - the helper function always has this name: __gftb_colornamehere_icon() this results in the following filters ready for usage:
add_filter( 'gftb_filter_main_icon', '__gftb_blue_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_lightgreen_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_lightgrey_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_orange_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_pink_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_red_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_turquoise_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_yellow_icon' );

add_filter( 'gftb_filter_main_icon', '__gftb_theme_images_icon' );

--> Where the last helper function returns the icon file (icon-gftb.png) found in your current theme's/child theme's /images/ subfolder

  • Example for using with current child theme:
add_filter( 'gftb_filter_main_icon', 'custom_gftb_main_icon' );
/**
 * Gravity Forms Toolbar: Change Main Icon
 */
function custom_gftb_main_icon() {
    return get_stylesheet_directory_uri() . '/images/custom-icon.png';
}

--> Uses a custom image from your active child theme's /images/ folder

--> Recommended dimensions are 16px x 16px

gftb_filter_main_icon_display

  • Returning the CSS class for the main item icon
  • Default value: icon-gravityforms (class is: .icon-gravityforms)
  • 1 Predefined helper function:
    • __gftb_no_icon_display() -- usage:
add_filter( 'gftb_filter_main_icon_display', '__gftb_no_icon_display' );

--> This way you can REMOVE the icon!

  • Another example:
add_filter( 'gftb_filter_main_icon_display', 'custom_gftb_main_icon_display_class' );
/**
 * Gravity Forms Toolbar: Change Main Icon CSS Class
 */
function custom_gftb_main_icon_display_class() {
    return 'your-custom-icon-class';
}

--> You then have to define CSS rules in your theme/child theme stylesheet for your own custom class .your-custom-icon-class

--> Recommended dimensions are 16px x 16px

gftb_filter_main_item

  • Default value: "Gravity Forms"
  • Example code for your theme's/child theme's functions.php file:
add_filter( 'gftb_filter_main_item', 'custom_gftb_main_item' );
/**
 * Gravity Forms Toolbar: Change Main Item Name
 */
function custom_gftb_main_item() {
    return __( 'Your custom main item title', 'your-textdomain' );
}

gftb_filter_main_item_tooltip

  • Default value: "Gravity Forms"
  • Example code for your theme's/child theme's functions.php file:
add_filter( 'gftb_filter_main_item_tooltip', 'custom_gftb_main_item_tooltip' );
/**
 * Gravity Forms Toolbar: Change Main Item Name's Tooltip
 */
function custom_gftb_main_item_tooltip() {
    return __( 'Your custom main item title tooltip', 'your-textdomain' );
}

Final note: I DON'T recommend to add customization code snippets to your main theme's/child theme's functions.php file! Please use a functionality plugin or an MU-plugin instead! This way you can also use this better for Multisite environments. In general you are then more independent from theme/child theme changes etc. If you don't know how to create such a plugin yourself just use one of my recommended 'Code Snippets' plugins. Read & bookmark these Sites:

All the custom & branding stuff code above can also be found as a Gist on Github: https://gist.github.com/2732242 (you can also add your questions/ feedback there :)

Requires: 3.6 or higher
Compatible up to: 3.9.1
Last Updated: 2014-2-26
Downloads: 28,497

Ratings

4 stars
4.7 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,3,3 100,2,2 100,2,2 100,4,4 100,4,4 100,1,1 100,4,4 100,2,2
100,5,5 100,2,2 100,2,2 83,6,5 100,5,5 100,1,1 100,4,4 100,2,2
100,4,4 100,1,1 100,4,4 100,2,2
100,4,4 100,4,4 100,6,6
100,4,4 100,4,4 100,6,6
100,1,1 100,5,5 100,6,6
100,4,4 100,6,6
100,4,4
100,4,4
100,1,1 100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1