New version of community (jomsocial) plugin

New pull request against master (K3.0), not develop (K3.1). 

Removes all white space changes from the first commit allowing us to see the real changes made to the code. Updated the code to match our latest code with a few J3.x fixes and other improvements.

Replaces #2539.

Will probably still need some fixes, I'm also going to add some comments to the changes.
No, only starting comment should have /**, which makes it PHPDoc comment. Closing one has no effect.