Custom 404 page - existing plugins?

I’m also looking for a way to customize the 404 page. One problem I’m having is that some sections of a forum are private. So when I link to it in chat or from another post, and the users aren’t logged in to the forum, it looks to them like I linked to a page that doesn’t exist. Users don’t like to think too much in general, so I think that many of them don’t pay attention to the “or is private” part of the “Oops! That page doesn’t exist or is private” message, because it looks like the page doesn’t exist.

What I would like to do is: if not logged in, and the page is a 404, then show the sign-up or log in form on top of the 404 page (without redirecting, since that might confuse search engines). If the user is logged in and they don’t have access, then the regular 404 page would be shown.

Does anyone know if there is a way to do that?