registered members is a simple COUNT(*) of the users table
As for the "who's online" and avatars, you'd need to make sure you're using database driven sessions and define an "inactive" time-limit for users who don't do anything (like sit and read one thread for an hour) so they're considered "inactive". Typically, 15 minutes is enough.
For the avatars, you'd need to read the current users online, then grab their avatar path from the database and add it as the src to the <img> tag in the HTML.
As for the "recent threads" on the forums, you'd have to query the threads (or topics) table of the forum and order them DESC by timestamp and grab the XX most recent threads (5 to 10 should be enough).