Hi
Here's my suggestion (better solution, in my opinion)
Why don't you try existing extension (most of all free extension) that provides this and much more? I mean, why invent what is already created?
Search on joomla extensions (something related with social communities) and i'm sure you will find it.
Cheers