PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Styling unread form entries in dashboard

  1. shayh
    Member

    Hi,

    I was hoping to find an easy way to style the unread form entries count on the dashboard. I have a client who finds it very hard to notice new unread entries on forms in the dashboard - yes he could/should use notifications but he'd like the dashboard to be a little more obvious when displaying these (maybe a background color, some padding around the anchor tag, etc).

    Any help would be much appreciated.

    Thanks,
    Shay

    Posted 11 years ago on Sunday February 3, 2013 | Permalink
  2. You can target unread entries in the admin. They have a class of .lead_unread. You can use something like this:

    [css]
    .lead_unread td {
      background-color: yellow;
    }

    That will target the unread entries. You want to add that CSS only to the admin pages though (adding that to your theme's stylesheet would not work.) You can use a function like this in your functions.php:

    [php]
    function load_custom_wp_admin_style() {
        wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/wp-admin.css', false, get_bloginfo('version') );
        wp_enqueue_style ( 'custom_wp_admin_css' );
    }
    add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

    That will load a stylesheet called "wp-admin.css" in your admin pages only. The file would have to be located in your theme directory. And in it you would add just those couple lines I posted initially, targeting the unread entries. Here is the WordPress reference for wp_enqueue_style: http://codex.wordpress.org/Function_Reference/wp_enqueue_style

    Posted 11 years ago on Monday February 4, 2013 | Permalink
  3. shayh
    Member

    Chris, thanks for the quick reply on this. Just to confirm the client is looking to have the unread count on the admin dashboard widget highlight unread form counts.

    From looking at gravityforms.php (line 1090) it seems the the dashboard forms widget doesn't apply the .lead_unread class to the relevant table cell/anchor:

    <td class="column-date" style="padding:8px 18px; text-align:center;"><a style="<?php echo $form["unread_count"] > 0 ? "font-weight:bold;" : "" ?>" href="admin.php?page=gf_entries&view=entries&filter=unread&id=<?php echo absint($form["id"]) ?>" title="<?php printf(__("Last Entry: %s", "gravityforms"), $date_display); ?>"><?php echo absint($form["unread_count"]) ?></a></td>

    Thanks,
    Shay

    Posted 11 years ago on Monday February 4, 2013 | Permalink
  4. Sorry, I was unclear from your first post. You want to change the display of the information in the form widget, not in the list of entries? It does not appear there are any classes applied to the widget columns which we can use. I'll check with the developers about the possibility of adding some.

    I was able to target the unread column in the widget by adding this CSS to the admin, but that highlights the number, no matter what it is (even if there are zero unread.)

    Screenshot: http://minus.com/lxjFDVXmYHEdo

    [css]
    #rg_forms_dashboard tr td:first-child + td a {
        color:green!important;
        font-size:24px!important;
    }

    You could use jQuery to remove the custom style (from above) from the table data cell when it didn't contains a zero, using the .contains selector: http://api.jquery.com/contains-selector/

    Posted 11 years ago on Tuesday February 5, 2013 | Permalink
  5. shayh
    Member

    Chris, thanks again for taking the time to look into this. I'll take a look at your suggestion of using the above css selector and jquery to see if I can get it the way the client would like it.

    Would be nice if the devs could consider adding a specific class to the widget for future releases :)

    Appreciate all your help,
    Shay

    Posted 11 years ago on Tuesday February 5, 2013 | Permalink
  6. Agreed. I sent it to the development team. Hopefully we can get it into a future release.

    Posted 11 years ago on Tuesday February 5, 2013 | Permalink
  7. We have added classes to the dashboard elements in version 1.7 so that you can style your Gravity Forms widget. You can find the selectors here: http://pastie.org/7700709

    Here is a screenshot targeting some of those elements: http://i.imgur.com/AvspL4y.jpg

    Here is a plugin you can use to target your WordPress admin CSS without having to worry about losing your changes on upgrade: http://wordpress.org/extend/plugins/add-admin-css/

    Thank you for the suggestion.

    Posted 10 years ago on Friday May 10, 2013 | Permalink