var_dump($paths);
shows that the your $paths variable is an empty string. It’s not showing anything because there is nothing to show.
Since you seem like you’re trying to find all the plugins, you should have a look at get_plugins
. glob
is going to be relative to the current working directory (with will vary depending on your server setup) and is_plugin_active
active takes a plugin_basename
.
get_plugins
will return an associative array with the plugin basenames as keys as the file header data as the values (in an array).
A few other notes:
admin_notices
does not automagically format your notices to look pretty. You can wrap it your notice with <div class="error">
or <div class="updated">
to do that.
Always give your functions a unique prefix or put them in a namespace (PHP 5.3+ only).
Revised code:
<?php
add_action('admin_notices', 'wpse72637_show_names');
function wpse72637_show_names()
{
$paths = array();
foreach(get_plugins() as $p_basename => $plugin)
{
$paths[] = "{$plugin['Name']}: " .
(is_plugin_active($p_basename) ? 'Active' : 'Disabled');
}
echo '<div class="updated"><p>', implode(' --- ', $paths), '<p></div>';
}