The Jomsocial User ObjectIn Jomsocial you can request the User Object with the class CFactory.
How to get the User Object
Include the Jomsocial core
If you are just customizing the Jomsocial template files or adding new functionalities to Jomsocial pages then the above code is enough.
But if you want to call the CFactory class from outside Jomsocial (for example from another component or from within a module) then you must include the Jomsocial core. In this case, the above code should be:
Using Jomsocial Features in your ExtensionThe Jomsocial API lets you integrate some basic Jomsocial functionalities with your extension.
JomSocial build-in personal messaging system
With this code, you can send a message to a user through the Jomsocial messaging system. You must use an onclick action to add this functionality to any link. The $userid can be a specific user id or the current user (see code above).
Link to User Profile Page
By using CRoute which is a replacement for Joomla JRoute, you can link to any part of JomSocial and the link will have the correct Itemid.