UserProfiles

A simple, yet powerful, profile system that leverages existing JReviews features (custom fields, media, reviews) and turns listings into public user profiles. The Add-on also provides registration and login functionality.

Overview

There are many social networking solutions available for both Joomla and WordPress and this add-on does not seek to match their features nor replace them. UserProfiles is for sites that need a simple system for allowing users to create public profiles.

If you need more community engagement, the EngageUsers Add-on implements follow and search alerts, an activity stream, and integrates well with UserProfiles.

UserProfiles takes advantage of the existing JReviews functionality, so it there's no overhead. The user profiles are regular JReviews listing, so you can enjoy all of the same functionality you already have for listings (favorites, inquiries, reviews, lists, maps, etc.).

Creating a public profile in UserProfiles is optional, and users will only be able to create their public profile after they have already registered on the site.

Getting Started

To get started you need the following:

  • A dedicated profiles directory in JReviews
  • One or more JReviews listing types to use for profiles, depending on whether you need different sets of custom fields and rating criteria.
  • One or more categories within the UserProfiles directory.

A dedicated profiles directory is needed for user profiles, because the add-on only allows one profile listing per user within this directory.

Once you have the basic setup above ready in JReviews, you can continue.

  1. Select the profiles directory in the UserProfiles configuration

    This will allow JReviews to recognize the listings as the user's public profile. Listing submissions to this directory are automatically limited to one per user since a user can only have one profile.

  2. Select UserProfiles Add-on in the JReviews Configuration → Community tab

    This connects a user's submissions (listings, reviews, etc.) with his public profile. The submissions will show the profile title as the author's name, and the main photo as the avatar.

  3. Create the UserProfiles menus:

    • Signup page for the user login and registration page → Account Menus → Signup
    • Account page where users can manage their profiles → Account Menus → Manage
    • Submit profile page → Submit Profile

    Need a refresher on Creating Menus?

  4. Create different profile types to be selected on initial registration

    Optional - Each profile type can have one or more user groups/roles associated. When users register on the site, they will be automatically placed in these groups/roles in Joomla and WordPress. It's not possible for users to switch between profile types.

  5. Publish the login module/widget

    Optional - The add-on comes with its own login Joomal module and WordPress widget. You can publish it on any position available in your template/theme to allow users to log in.

Finally, you can go over the rest of the settings in the Add-on configuration to fine tune them for your site.

You are all set and the following should now be working on your site:

  • Users can create a single profile listing within the profiles directory.
  • Listings within the profiles directory are used to populate the user's name and avatar on all her JReviews submissions (listings, reviews, comments, media, etc.).

Module & Widget Positions

The add-on comes with two custom positions in the sign-up page. If you have a 3rd logic party solution for social networks you can use these positions to add any code provided by the solution to show the login buttons in the sign-up page (Google, Facebook, etc.).

  • jr-userprofiles-below-login
  • jr-userprofiles-below-registration

Language Strings

Read the languages & locatization article to learn more about customizing language strings. Since profiles are listings, you can use the language overrides functionality in listing types to quickly change some of the strings for profiles.

For example, instead of having strings that say "listing", you can make changes in the Listing Type → Language tab to show "profile".

Profile Template

UserProfiles implements its own version of the listing detail template using a _profile suffix. You should take this into account if you are looking to customize the detail page. The template name is detail_profile.thtml.

If you add a theme suffix to a UserProfiles category, it will be appended to current name. So for example, if you add the _seller suffix, the expected template name will be detail_profile_seller.thtml.

Take advantage of the Theme Explorer functionality to easily discover the location of template files.

Available Hooks

The add-on implements hooks that can be used to modify and extend its functionality.

Customizations

The add-on offers several helper methods that can be used in hooks, templates and other files.


UserprofilesProfileComponent::hasProfile($userId = null)

Check if the logged in user, or a specific user ID, has a public profile.

if (UserprofilesProfileComponent::hasProfile())
{
   // User has a profile
}

UserprofilesProfileComponent::getOneProfile($userId = null)

Get the $listing array for the logged in user, or for a specific user ID.

if ($listing = UserprofilesProfileComponent::getOneProfile())
{
   // do something with the profile $listing array
}

UserprofilesProfileComponent::getProfile($userIds)

Pass an array of user IDs to retrieve their profile listings.


UserprofilesProfileComponent::getOneProfileType($userId = null)

Get the profile type for the logged in user, or for a specific user ID.

if ($profileType = UserprofilesProfileComponent::getOneProfile())
{
   // do something with the $profileType array
}

UserprofilesProfileComponent::getProfileType($userIds)

Pass an array of user IDs to retrieve their profile types.


If you need to get the profile listing array outside of JReviews, you can use the following code. First require the JReviews framework:

Joomla

require_once JPATH_ROOT.'/components/com_jreviews/jreviews/framework.php';

WordPress

require_once ABSPATH.'/wp-content/plugins/jreviews/jreviews/framework.php';

Then:

S2App::import('Component','userprofiles_profile','jreviews');

S2App::import('Model','everywhere_com_content','jreviews');

// Leave userId param empty to use the logged in user, otherwise pass a user ID

$profile = UserprofilesProfileComponent::getOneProfile($userId = null);