bugsnag / bugsnag-wordpress

BugSnag error monitoring for WordPress sites
http://wordpress.org/plugins/bugsnag/
GNU General Public License v2.0
20 stars 15 forks source link

Include Plugin/Theme Versions #51

Open bhubbard opened 4 years ago

bhubbard commented 4 years ago

It would be really useful to report plugin/themes versions out of the box, maybe this can be included in the runtimeVersions section?

johnkiely1 commented 4 years ago

Hi @bhubbard,

Thanks for this, we will look into this when we can.

drsdre commented 1 year ago

Given that there is only one theme active at the time, the following code adds the theme title and version to bug reports:

    $bugsnagWordpress->setContext(wp_get_theme()->get('title'));

    $version = wp_get_theme()->get('Version');
    $bugsnagWordpress->setAppVersion($version);

An enhancement to this is to also get the main theme name of current theme is a child theme.

Regarding detecting if a bug has happened within a plugin, I can imagine that plugin name can be gathered when the file in which the bug occurred is in the wp-content/plugins/(.*)/{0,1} directory ($1 would yield it's name).