@Shemo and RocketFoot: I'm really really sorry. Please don't misunderstand me I've said this so many times. I'm still learning. I'm not a coder. I hope you can understand me.
Replace the blah with something else. It's like a "password" to access the default threadlist layout. We need the default threadlist layout to manage threads in our Usermap forum.
Enable XThreads' Inline Forum Search:Yes
Settings Overrides:
Setting: Output template start/end comments?
Value: 0
Code:
tplhtmlcomments=0
Hide Forum:Yes
We need to put the forum URL directly in our template. Example: in our header template.
Allow Blank Post Message:Yes
Custom WOL Text:
Forum Display: Viewing <a href="{1}">{2}</a>
New Thread: Marking a new Marker
New Reply: Commenting on <a href="{1}">{2}</a> Marker
Show Thread: Viewing <a href="{1}">{2}</a> Marker
Custom Thread Fields
There is no a fix settings for whatever custom thread fields needed for our Usermap. The only requirement for this is the Geo Location custom thread fields, which holds the geographic location that needed by Google Maps to place a marker on it.
But, because we use XThreads here, personally, I don't want to stop at there only (you know that XThreads has a bunch of features and very very flexible). So, we will create two additional custom thread fields as an example, one custom thread field for text (description), and the other one is for image. In this example, we will try to use the click event provided by Google Maps, and put the XThreads contents (the text and the image) in the popup produced by the event handler. Do not create those additional custom thread fields if we don't want it.
Create a Custom Thread Fields with these settings:
AdminCP -> Configuration -> Custom Thread Fields
File for Image (Optional):
Skip this if we don't want any image displayed in the marker's popup, or if we don't want to use the click event.
Title: Image
Key: umap_img
Description: The thumbnail of this image will be displayed as tooltip. Max Size: 200KB
Modify it as our needs. Related to the Maximum File Size setting.
Applicable Forums:'select our Usermap forum'
Input Field Type: File
Valid File Extensions: jpg|gif|png|jpeg
Maximum File Size: 204800
Modify it as our needs. Related to the Description setting.
Editable by / Required Field?: Everyone
This is not a required custom thread field. Modify it as our needs. For example, we can set which usergroup(s) are allowed to attach image in their marker on the Usermap.
Display Order: 1
Only Accept Image Files:Yes
Image Thumbnail Generation: 120x90
Modify it as our needs. This is the thumbnail dimension of the image that will be displayed in the marker's popup.
Modify it as our needs. The 120x90 part is related to the Image Thumbnail Generation setting.
Textbox for Short Description (Optional):
Skip this if we don't want any additional text displayed in the marker's popup, or if we don't want to use the click event.
Title: Description
Key: umap_desc
Description: This description will be displayed in your pin as tooltip
Modify it as our needs.
Applicable Forums:'select our Usermap forum'
Input Field Type: Textbox
Editable by / Required Field?: Everyone
This is not a required custom thread fields. Modify it as our needs.
Display Order: 2
Textbox for Geo Location (Required):
This custom thread field will hold the geographic location that needed by Google Maps to place a marker on it. So, this is a required field. We will try to use the Geocoder service provided by Google Maps and a simple javascript to "auto fill" this custom thread field (in newthread and editpost page).
Title: Geo Location
Key: umap_geol
Description: If you don't know what's your geo location, please use the geo locator on the left.
Modify it as our needs.
Applicable Forums:'select our Usermap forum'
Input Field Type: Textbox
Editable by / Required Field?: Everyone (required)
Display Order: 3
Because we need to put other custom thread fields contents into this field's Display Format (in this example), we need to assign the last Display Order for this field (bigger than other custom thread fields' Display Order).
Well, I'm totally zero with regex So, modify it as our needs. Basically, this field should accept format like: (x coordinate, y coordinate). Each coordinate may have a negative or positive value, and may have decimal value. Surround them with a bracket, and separate them with a comma.
Global Templates
Create new templates in Global Template.
Admin CP -> Templates & Style -> Templates -> Global Templates:
This template is used for the pagination of the default layout. Maybe we need to add the other multipage template, like multipage_end, multipage_nextpage, multipage_page_link_current, multipage_prevpage and multipage_start.
We move all contents of this template to threadlist template, because we need to modify the header tag and put {$threads} variable in it. So, do not add subforum inside our Usermap forum.
umap_forumdisplay_thread
Code:
{$GLOBALS['threadfields']['umap_geol']}
Because MyBB repeat this template in forumdisplay, we will use it for displaying the markers. With this way, we can put XThreads contents into the popup produced by the Google Maps click event handler. We put this template inside the header tag.
umap_postbit_first and/or umap_postbit_first_classic (Optional)
Skip this template if we don't want to display user's map on the postbit and preview page.
Basically, we need to put this code in these templates for displaying the user's map:
HTML Code
<divid="map_postbit"style="width:100%;height:300px;margin: auto auto;"></div>
So, copy and paste the entire our postbit/classic template into the new templates, and insert the code above.
Example for the umap_postbit_first template:
We use forumdisplay threadlist for our usermap. So, there is a threads per page setting that we need to set. It's under the XThreads Forum Settings. Each thread means each marker. For example, if we set the setting to display 20 threads per page, it means that we have 20 markers per page.
There is a possibility that we use XThreads filter system to create Map Region.
If we want one marker (thread) per user only, we need a plugin for that (attached). Find $umap_fid under umap_nt() function. Change the value to our XThreads Usermap forum id for limiting the num of pin for each user. By default, it is disabled.
Find $umap_fid under umap_run() function. Change the value to our XThreads Usermap forum id for displaying user's location on their profile page. By default, it is disabled.
Please tell me if there is something wrong with the code above. I'm still learning.
Screenshots:
Newthread and Editpost:
If we use the umap_postbit_first/classic and umap_showthread templates, we can use the preview page:
If we use the umap_postbit_first/classic and umap_showthread templates, the shwothread page will be like this:
Threadlist (our usermap):
If we use the additional custom thread fields and the click event handler, we have the XThreads custom thread fields contents in a marker's popup:
Cluster Marker:
And the default threadlist layout (accessed by using the &view=blah, depends on the setting):