Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
393 views
in Plugins by
edited by

Hi, I am trying to install bugsnag (bugsnag.com), a bug notification library on our Q2A site. The site is integrated with Wordpress, but from the looks of it the bugsnag library needs to be installed with the Q2A site (instead of via the Wordpress admin console which does not give the option). Where's the best place to install the library and put the bugsnag code:

require_once "/path/to/Bugsnag/Autoload.php";

3. Configure Bugsnag with your API key

$bugsnag = new Bugsnag_Client("xxxxxxxx");

This code includes your unique Bugsnag API key, and should be copied directly into your code.

4. Enable automatic error and exception notification by attaching Bugsnag's error and exception handlers

set_error_handler(array($bugsnag, "errorHandler"));
set_exception_handler(array($bugsnag, "exceptionHandler"));

Thanks!

Q2A version: 1.5.4

1 Answer

0 votes
by

I think your best bet would be to make a process module plugin. Use the init_page() function and put your code in there.

by
Thanks for the quick response. Bugsnag recommends using Composer (https://getcomposer.org) to install their library.  Is it fine to use composer with Q2A?
by
Yes it should be fine. Q2A doesn't currently use Composer so there won't be any conflicts there.

Even if we do in future, all you'd need to do is add a line to your composer.json.
by
Thanks Scott for your help. Do you have any advice on setting up the process module?  There is a tutorial on creating a plugin, but the docs suggest that a process module is set up very differently from a plugin.

http://docs.question2answer.org/plugins/
"As of Q2A 1.5, it is not recommended for qa-plugin.php to perform any other actions - if this seems necessary, please consider using a process module instead."
...