7 Improved title, tags
| link

How to hook into add_options_page to create Add update notification bubble to admin menu item?

6 deleted 117 characters in body
source | link

I have re-worded this to make more sense.

Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file.

I want to show a menu bubble like this enter image description here when an update is available.

It can show just a "1" or text like "alert", it doesn't matter.

Since my plugin uses an options page (using add_options_page) the plugin settings show up under the default "Settings" submenu.

I think I need to add the following CSS to get the bubble to show up,

<span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

and tie into the global $submenu. The problem is I cannot use a hard-coded array value for the menu since each site will have different values.

So I cannot use $submenu[80][10] .= <span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

How can I find my plugins submenu value, do I have to loop through the array and match the string values?

Also even when I hard-coded the values I could not get the bubble to show up.

//adding plugin to menu
add_action('admin_menu', 'sec_plugin_checker');

function sec_plugin_checker() {
  add_options_page(' Plugin Checker', 'Plugin Check', 'activate_plugins', 
  'sec_plugin_check', 'sec_checker');


// the conditional where I want the bubble to appear

if (!empty($matches)){ 
    echo "Match found !<br />";

    global $submenu;
    foreach( $submenu as $item ) {

       $update_count  = 1;
       $update_title = "hi";

       $item[41][20] = sprintf( __( 'Updates %s', 'sec_plugin_checker' ),  
                 "<span class='update-plugins count-$update_count'1' title='$update_title'>title='title'>
                  <span class='update-count'>1</span></span>");  

       }
  }

and here is what a var_dump($submenu); looks like,

["options-general.php"]=>
array(9){
...

[41]=>
    array(4) {
      [0]=>
      string(20) "Plugin Check"
      [1]=>
      string(16) "activate_plugins"
      [2]=>
      string(21) "sec_plugin_check"
      [3]=>
      string(23) " Plugin Checker"

     ...

      }

I have re-worded this to make more sense.

Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file.

I want to show a menu bubble like this enter image description here when an update is available.

It can show just a "1" or text like "alert", it doesn't matter.

Since my plugin uses an options page (using add_options_page) the plugin settings show up under the default "Settings" submenu.

I think I need to add the following CSS to get the bubble to show up,

<span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

and tie into the global $submenu. The problem is I cannot use a hard-coded array value for the menu since each site will have different values.

So I cannot use $submenu[80][10] .= <span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

How can I find my plugins submenu value, do I have to loop through the array and match the string values?

Also even when I hard-coded the values I could not get the bubble to show up.

//adding plugin to menu
add_action('admin_menu', 'sec_plugin_checker');

function sec_plugin_checker() {
  add_options_page(' Plugin Checker', 'Plugin Check', 'activate_plugins', 
  'sec_plugin_check', 'sec_checker');


// the conditional where I want the bubble to appear

if (!empty($matches)){ 
    echo "Match found !<br />";

    global $submenu;
    foreach( $submenu as $item ) {

       $update_count  = 1;
       $update_title = "hi";

       $item[41][20] = sprintf( __( 'Updates %s', 'sec_plugin_checker' ),  
                 "<span class='update-plugins count-$update_count' title='$update_title'>
                  <span class='update-count'>1</span></span>");  

       }
  }

and here is what a var_dump($submenu); looks like,

["options-general.php"]=>
array(9){
...

[41]=>
    array(4) {
      [0]=>
      string(20) "Plugin Check"
      [1]=>
      string(16) "activate_plugins"
      [2]=>
      string(21) "sec_plugin_check"
      [3]=>
      string(23) " Plugin Checker"

     ...

      }

I have re-worded this to make more sense.

Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file.

I want to show a menu bubble like this enter image description here when an update is available.

It can show just a "1" or text like "alert", it doesn't matter.

Since my plugin uses an options page (using add_options_page) the plugin settings show up under the default "Settings" submenu.

I think I need to add the following CSS to get the bubble to show up,

<span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

and tie into the global $submenu. The problem is I cannot use a hard-coded array value for the menu since each site will have different values.

So I cannot use $submenu[80][10] .= <span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

How can I find my plugins submenu value, do I have to loop through the array and match the string values?

Also even when I hard-coded the values I could not get the bubble to show up.

//adding plugin to menu
add_action('admin_menu', 'sec_plugin_checker');

function sec_plugin_checker() {
  add_options_page(' Plugin Checker', 'Plugin Check', 'activate_plugins', 
  'sec_plugin_check', 'sec_checker');


// the conditional where I want the bubble to appear

if (!empty($matches)){ 
    echo "Match found !<br />";

    global $submenu;
    foreach( $submenu as $item ) {

    $item[41][20] = sprintf( __( 'Updates %s', 'sec_plugin_checker' ),  
                "<span class='update-plugins count-1' title='title'>
                 <span class='update-count'>1</span></span>");  

       }
  }

and here is what a var_dump($submenu); looks like,

["options-general.php"]=>
array(9){
...

[41]=>
    array(4) {
      [0]=>
      string(20) "Plugin Check"
      [1]=>
      string(16) "activate_plugins"
      [2]=>
      string(21) "sec_plugin_check"
      [3]=>
      string(23) " Plugin Checker"

     ...

      }
5 deleted 6 characters in body
source | link

I have re-worded this to make more sense.

Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file.

I want to show a menu bubble like this enter image description here when an update is available.

It can show just a "1" or text like "alert", it doesn't matter.

Since my plugin uses an options page (using add_options_page) the plugin settings show up under the default "Settings" submenu.

I think I need to add the following CSS to get the bubble to show up,

<span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

and tie into the global $submenu. The problem is I cannot use a hard-coded array value for the menu since each site might will have different values.

So I cannot use $submenu[80][10] .= <span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

How can I find my plugins submenu value, do I have to loop through the array and match the string values?

Also even when I hard-coded the values I could not get the bubble to show up.

//adding plugin to menu
add_action('admin_menu', 'sec_plugin_checker');

function sec_plugin_checker() {
  add_options_page(' Plugin Checker', 'Plugin Check', 'activate_plugins', 
  'sec_plugin_check', 'sec_checker');


// the conditional where I want the bubble to appear

if (!empty($matches)){ 
    echo "Match found !<br />";

    global $submenu;
    foreach( $submenu as $item ) {

       $update_count  = 1;
       $update_title = "hi";

       $item[41][20] = sprintf( __( 'Updates %s', 'sec_plugin_checker' ),  
                 "<span class='update-plugins count-$update_count' title='$update_title'>
                  <span class='update-count'>1</span></span>");  

       }
  }

and here is what a var_dump($submenu); looks like,

["options-general.php"]=>
array(9){
...

[41]=>
    array(4) {
      [0]=>
      string(20) "Plugin Check"
      [1]=>
      string(16) "activate_plugins"
      [2]=>
      string(21) "sec_plugin_check"
      [3]=>
      string(23) " Plugin Checker"

     ...

      }

I have re-worded this to make more sense.

Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file.

I want to show a menu bubble like this enter image description here when an update is available.

It can show just a "1" or text like "alert", it doesn't matter.

Since my plugin uses an options page (using add_options_page) the plugin settings show up under the default "Settings" submenu.

I think I need to add the following CSS to get the bubble to show up,

<span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

and tie into the global $submenu. The problem is I cannot use a hard-coded array value for the menu since each site might will have different values.

So I cannot use $submenu[80][10] .= <span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

How can I find my plugins submenu value, do I have to loop through the array and match the string values?

Also even when I hard-coded the values I could not get the bubble to show up.

//adding plugin to menu
add_action('admin_menu', 'sec_plugin_checker');

function sec_plugin_checker() {
  add_options_page(' Plugin Checker', 'Plugin Check', 'activate_plugins', 
  'sec_plugin_check', 'sec_checker');


// the conditional where I want the bubble to appear

if (!empty($matches)){ 
    echo "Match found !<br />";

    global $submenu;
    foreach( $submenu as $item ) {

       $update_count  = 1;
       $update_title = "hi";

       $item[41][20] = sprintf( __( 'Updates %s', 'sec_plugin_checker' ),  
                 "<span class='update-plugins count-$update_count' title='$update_title'>
                  <span class='update-count'>1</span></span>");  

       }
  }

and here is what a var_dump($submenu); looks like,

["options-general.php"]=>
array(9){
...

[41]=>
    array(4) {
      [0]=>
      string(20) "Plugin Check"
      [1]=>
      string(16) "activate_plugins"
      [2]=>
      string(21) "sec_plugin_check"
      [3]=>
      string(23) " Plugin Checker"

     ...

      }

I have re-worded this to make more sense.

Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file.

I want to show a menu bubble like this enter image description here when an update is available.

It can show just a "1" or text like "alert", it doesn't matter.

Since my plugin uses an options page (using add_options_page) the plugin settings show up under the default "Settings" submenu.

I think I need to add the following CSS to get the bubble to show up,

<span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

and tie into the global $submenu. The problem is I cannot use a hard-coded array value for the menu since each site will have different values.

So I cannot use $submenu[80][10] .= <span class='update-plugins count-1' title='title'><span class='update-count'>1</span></span>

How can I find my plugins submenu value, do I have to loop through the array and match the string values?

Also even when I hard-coded the values I could not get the bubble to show up.

//adding plugin to menu
add_action('admin_menu', 'sec_plugin_checker');

function sec_plugin_checker() {
  add_options_page(' Plugin Checker', 'Plugin Check', 'activate_plugins', 
  'sec_plugin_check', 'sec_checker');


// the conditional where I want the bubble to appear

if (!empty($matches)){ 
    echo "Match found !<br />";

    global $submenu;
    foreach( $submenu as $item ) {

       $update_count  = 1;
       $update_title = "hi";

       $item[41][20] = sprintf( __( 'Updates %s', 'sec_plugin_checker' ),  
                 "<span class='update-plugins count-$update_count' title='$update_title'>
                  <span class='update-count'>1</span></span>");  

       }
  }

and here is what a var_dump($submenu); looks like,

["options-general.php"]=>
array(9){
...

[41]=>
    array(4) {
      [0]=>
      string(20) "Plugin Check"
      [1]=>
      string(16) "activate_plugins"
      [2]=>
      string(21) "sec_plugin_check"
      [3]=>
      string(23) " Plugin Checker"

     ...

      }
4 added 433 characters in body; added 5 characters in body
source | link
3 added 1414 characters in body; deleted 122 characters in body; added 54 characters in body
source | link
2 added 107 characters in body; added 70 characters in body; edited body; added 3 characters in body
source | link
1
source | link