Can't issue remove_action commands for Directory DR_Ratings class


The Directory plugin doesn’t save an identifier when it creates the DR_Ratings class, which means it (appears to be) impossible to issue remove_actions in a theme’s functions.php to prevent the Directory plugin from adding the ratings JavaScript in the header.

Essentially, if you change:

--- directory/core/ratings.php	2013-01-23 17:02:31.418257930 +1100
+++ directory/core/ 2013-01-23 17:06:42.120636402 +1100
@@ -327,4 +327,5 @@


-new DR_Ratings();
+global $dr_ratings;
+$dr_ratings = new DR_Ratings();

Then you can do stuff like this in a theme’s functions.php:

global $dr_ratings;

remove_action( 'wp_enqueue_scripts', array( $dr_ratings, 'enqueue_styles' ) );
remove_action( 'wp_enqueue_scripts', array( $dr_ratings, 'enqueue_scripts' ) );
remove_action( 'wp_head', array( $dr_ratings, 'print_scripts', 1 ) );

Please can you consider modifying your plugin classes to be called in this way, so that we have the option of removing actions without editing the plugin code!