Just another update on this one - Ive just made some improvements to this code.
Previously (after my brute force code above) the "Mark all forums read" option was available on any set of serach results.
i.e. if you serached for engine bay, and you had 12 results, some of which were unread - the option to mark all forums read was visible - some people may have clicked this believing it would only mark those results as read, when in actual fact it would mark ALL forums read - regardless of whether they were in your set of search results of not.
The changes I have just made now only makes the "mark all forums read" option visible when you have clicked "view unread posts" - therefore showing ALL your unread posts.
When conducting a normal search, this option will not be available at the top of the results in order to avoid people accidentaly marking all their unread items as read.