Index: plugins.php =================================================================== --- plugins.php (revision 4029) +++ plugins.php (working copy) @@ -149,8 +149,11 @@ } $return = array(); + // $arg1 should always be the theme object, but we'll check + $arg1 = reset($filter_args); foreach ( self::$hooks['theme'][$hookname] as $priority ) { foreach ( $priority as $filter ) { + $execute_ok = true; // $filter is an array of object reference and method name $callargs = $filter_args; if(is_array($filter)) { @@ -159,12 +162,25 @@ } else { $module = get_class($filter[0]); + if($filter[0] instanceof Theme && $module != get_class( $callargs[0] )) { + continue; + } } } else { $module = $filter; + /* + if the hook is in a theme descendant class and the class is not the + theme instance calling the hook (passed in $arg1 by convention) then + don't execute this hook + */ + if($arg1 instanceof Theme && $arg1 != $filter[0]) { + $execute_ok = false; + } } - $return[$module] = call_user_func_array( $filter, $callargs ); + if($execute_ok) { + $return[$module] = call_user_func_array( $filter, $callargs ); + } } } if(count($return) == 0 && substr($hookname, -6) != '_empty') {