The forumid global will only be available if there is a -f or -forum parameter, and there isn't for an attachment. There doesn't seem to be any way to do what you want to do in a plugin unless you do your own query to find out what forum the postid or attachmentid is related to (if you look at attachment.php and search for 'attachment_start' you can see what's going on there).
Of course if you don't mind modifying the php files you could insert your code in attachment.php somewhere after the query has been done. Then you would use $attachmentinfo['forumid'] instead of the global.
|