Requirement:
XThreads
This is a simple example of affiliates system application using XThreads, combined by using custom thread fields as plugin settings.
With this very simple example application, we can let our users (affiliates) to create a new affiliates (or ads - whatever it is) "proposal" by themselves, they have an ability to upload their won banner directly.
Since it is based on the default MyBB threads, so the forum owner can negotiate it with the users directly in the thread (for example, how many clicks the user wants for the banner - the forum owner has an ability to set the max clicks for each banner).
If the max clicks set by the forum owner reached the limit, it will be set to Expired automatically. Or, if the "negotiation" failed, the forum owner can reject it (set the status to Rejected" - we may close the thread or leave it open for further "negotiation").
- Create/Edit a forum with these settings:
- Template Prefix: af_
- Language File Prefix: af_
- Allow Blank Post Message: Yes
- Forum Permissions:
Set this forum viewable by usergroups that have an ability to manage the affiliates (for ex: Administrator) only.
Set the forum permission "View Own Threads Only" for any usergroups that are allowed to make a proposal (threads) for new affiliate.
Set this forum unviewable for other usergroups.
- Create Custom Thread Fields:
- URL
The URL where the user will be lead after clicking the affiliate banner.
- Title: URL
- Key: af_url
- Applicable Forums: Select the Affiliate forum
- Editable by / Required Field? Everyone (required)
- Text Mask Filter: URL (HTTP/S)
- Description
Description of the URL
- Title: Description
- Key: af_desc
- Applicable Forums: Select the Affiliates forum
- Display Order: 2
- Editable by / Required Field? Everyone
Modify it if it should be a required field.
- Maximum Text Length: 100
Modify it as our needs
- Banner, it will be displayed on index pages.
- Limit Views
This is the limit views for each affiliates.
- Title: Limit Views
- Key: af_limit_views
- Applicable Forums: Select the Affiliates forum
- Display Order: 4
- Editable by / Required Field? Administrator
Modify it as our needs.
- Maximum Text Length: 5
- Text Mask Filter: Digits
- Default Value: 0
- Field Input Width: 5
- Blank Replacement Value:
- Underlying Data Type: Integer (unsigned, usually 32-bit)
- Views
This is the views counter for each affiliates.
- Title: Views
- Key: af_views
- Applicable Forums: Select the Affiliates forum
- Display Order: 5
- Editable by / Required Field? Administrator
Modify it as our needs.
- Maximum Text Length: 5
- Text Mask Filter: Digits
- Default Value: 0
- Field Input Width: 5
- Blank Replacement Value:0
- Filtering Mode:Exact match
- Underlying Data Type: Integer (unsigned, usually 32-bit)
- Status
This is the status for each affiliates, whether it is pending, rejected, approved or expired (based on the Views).
- Create new templates (optional):
- af_forumdisplay_threadlist
- af_forumdisplay_thread
- We use custom language file for this (attached). Upload it to our inc/languages/english/ directory or other language dirs.
- We use an additional plugin for this (attached). Upload it to our inc/plugins/ directory.
Change this setting before uploading it (line #57 and #81):
Forumdisplay for Administrator (if the custom templates above created):
Forumdisplay for each affiliates (please make sure to set the forum permission stated above)
Note that the Views is the banner clicks counter (not the thread views) compared to the Views Limit.
Index:
Edit the
mnxt_af and
mnxt_af_af templates provided by the plugin if we want. Make sure there is
{$mnxt_af} variable inside our
index template.
After clicking the banner, the clicker will be redirected to the affiliate URL (opening new tabs/windows by default - change this behaviour in
mnxt_af_af by removing the
target="_blank" if we don't want it to be like it)
Please tell me if I do something wrong with this example application. I'm still learning.