Getting a Fatal Error when activating Ultimate Facebook

When I try to activate Ultimate Facebook I get a fatal error:

Plugin could not be activated because it triggered a fatal error
Fatal error: Cannot redeclare class FacebookApiException in {directory}/wp-content/plugins/wpmu-dev-facebook/lib/external/base_facebook.php on line 107

The reason for the error is that a second Facebook plugin was also active - so the two plugins are clashing because they both declare the same function. My temporary solution is to deactivate the other plugin. But this isn't ideal because I want to use some of the functionality from that other plugin, so want to run both.

I found someone else with the same error and they had a solution:

It's a simple line of code that ensures the function is only declared once.

Just replace:


With this code:

if (!class_exists('FacebookApiException')) {

Two questions:
1) Where do I add this code to Ultimate Facebook?
2) When Ultimate Facebook updates, it will overwrite my adjusted code, so how can this line of code please be added to Ultimate Facebook, so it gets along nicely with other Facebook plugins?