WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Making Dashboard Alerts (2 posts)

  1. volomike
    Member
    Posted 4 years ago #

    How can I make a plugin send an alert to one's dashboard at the top right below where the WordPress upgrade notice might normally appear?

    I imagine I need some kind of add_filter() or add_action() call in the plugins' code.

  2. volomike
    Member
    Posted 4 years ago #

    <? function addDashboardAlert() { ?>
    <style type="text/css">
    .alert {
    padding-top:4px;
    padding-bottom:6px;
    padding-left:302px;
    background-color:#ebfbff;
    border-bottom:1px solid #CCC;
    display:none;
    }
    </style>
    <script type="text/javascript">
    $j = jQuery;
    $j().ready(function(){ //when page has fully loaded
      $j('h2:contains("Dashboard")').parent().prev().after('<div id="my-plugin-alert" class="alert">X Plugin 2.0 is available. <a href="">Upgrade Now!</a></div>');
      setTimeout("$j('#my-plugin-alert').fadeIn('slow');clearTimeout();",1000);
    });
    </script>
    <? } add_action('admin_head','addDashboardAlert'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic