Knowledge Base - Getting Started Guide
Plugin : profiles components
This plugin allows you to add a map into the user profile, and to geocode based on the profile address. There are 2 versions of this plugin depending on the profile manager you use:
- Community Builder
In addition to using a Geocode Factory map, this plugin also offers an option to use a static map (image map), which can potentially be an advantage in a page's loading performance.
This tutorial is both for Community Builder and Jomsocial, the plugins have similar features and configurations, and where there is a difference we will indicate it with a "CB" or a "JS".
The plugins are installed with the Geocode Factory package. Including the CB plugin. You have nothing to do.
Once the installation is done, you will need to publish the plugin just like any Joomla! plugin. You can open the plugin configuration and edit the settings. You will find more info about publishing the plugin in the CB or JS documentation.
Geocode Factory map
To use the profiles plugins, you need always one Geocode Factory map even if you select the static map. This is because it uses primary settings from a custom map regarding size etc. The static map creation happens on rendering which is where the speed advantage comes in to play. Our advice here is to create a very simple map, don't use side controls, just the [map] placeholder in the map manager, to prevent user confusion.
Geocode Factory Markerset
If you use the dynamic map option, you need to have/create a markerset that include all users. Then, the map will always be centered on the current user.
First we need to map the fields to link the profile location fields with the plugin. For example, if we have a field named 'country' in the CB/JS component that will content the user's country, we need to write in the name of this field in the plugin's field assignation. In our example : 'field_country', or 'cb_country' (the name of the field).
Because the plugin supports 3 addresses per profile (like home/work/vacancy) there are 3 field assignment areas. In the following example we use 2 addresses, primary and secondary. For both we have used the same country field, and different cities field.
CB : Custom CB fields usually start with cb_ ... as cb_office_zipcode
JS : Custom Jomsocial fields usually start with FIELD_ ... as FIELD_OFFICE_ZIPCODE
CB : the coordinates fields are always created by the plugin, and are named 'cb_plug_lat', 'cb_plug_lng', 'cb_plug_lat2', ... and all field are created even you use only one address per profile.
JS : since version 2.0, Jomsocial utilizes internal coordinates fields. You can use them by selecting the 'Use Jomsocial internal fields'. This is used for the primary address only! If you use a second or third address per profile, you need to create the corresponding custom fields in JS (FIELD_LATITUDE_2, ...) and enter the field names appropriately. Here is an example :
- Number of addresses : Define here how many addresses the plugin will use and geocode for this application.
- ID of the Geocode Factory map to use : Here you need to set the ID of the Geocode Factory map to use. First, create a simple map in the component (don't use clustering, center on browser or other advanced features like radius, ...). Second, create a markerset that include the whole community with no filters. This is very important to be sure that at least the current profile owner is visible. See these articles if you need to learn how to create Geocode Factory maps and markersets.
- Zoom for static map : for the Geocode Factory's map, the zoom is calculated automatically to be centered on the current profile marker. If you are using multiple addresses, the zoom is calculated to see each profile's marker. For the static map, we cannot calculate the zoom factor to include the 3 markers. So you will need to enter the zoom factor manually.
- Show the icons above map : Draw the icons of the user below the map, and it allow to show or not this information.
- Labels : it's the text near the icons below the map "Primary address"...
Note : As stated earlier, the plugin must get its static map configuration information (map type, map size, ...) from a Geocode Factory map so for either a dynamic or static map, you must still specify a Geocode Factory map ID.
Community builder settings
If you are using a tabbed view for your profiles, you need to give the tabs container DIV's id to the plugin. The plugin includes the defaults styles (cb_tabmain), but you can have other ones, and is some cases you need to include the parent DIV style too. This is depending the templates.
The geocoding feature gets the profile coordinates based on the field assignment.
Settings options are :
- Auto geocode during registration : Geocode when user creates the profile.
- Auto geocode during edit : Run the geocode when user edits and saves an existing profile.
Note : Jomsocial does this automatically (see JS component settings) since version 2, but can be useful if you use custom coordinate fields.
Community Builder only features
- Show map tab during registration : Allow user to pick a point on a map during the registration. You need to publish the corresponding (primary, secondary, ...) coordinates fields in registration form (see CB custom fields manager).
- Auto geocode before profile edit : Run the geocode before user edits an existing profile.
- Add geocode button : add a geocode button that will place the marker on the map dynamically based on the entered address. The user can then drag the marker to get a more precise location.
- Text for the no fetch checkbox : Text displayed in the 'No fetch checkbox'. This option is important if the user takes more than 1 hour to place the marker in a custom position and you have set the 'geocode at edit' option to yes. If this option is not set under those conditions than the custom position will be overwritten by the automatically geocoded position. If the user checks this box, the auto-geocode function is not executed.
- Checked by default : define the default state, or hide this option.
Example of results
These are some examples of the plugin with detailed explanations.
This view shows the current user's CB profile. This user has 2 addresses. The zoom and centering is set to center the map over both markers :
You can also place the map in a non tab position like in MyJoom CB profiles page :
You must do the same thing in Jomsocial with connections lines (because on this map we have not only the profiles markerset ...) :
This last screenshot, shows the markers linked by a line (markerset option), feature from the markerset :
Static map in users profile :
Geocode Factory 3