Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Affiliates
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Affiliates
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.
      • Title: Banner
      • Key: af_banner
      • Applicable Forums: Select the Affiliates forum
      • Input Field Type: File
      • Display Order: 3
      • Editable by / Required Field? Everyone (required)
      • Valid File Extensions: png|jpg|jpeg
        Modify it as our needs
      • Maximum File Size: 10240
        Modify it as our needs. It is in bytes.
      • Only Accept Image Files: Yes
      • Minimum Image Dimensions: 100x50
        Modify it as our needs
      • Maximum Image Dimensions: 100x50
        Modify it as our needs.
        Note that we only use a single dimension of image. So we don't create any thumbnail for it.
      • Description: Please upload your 100x50 banner.
        Modify it as our needs. Related to Dimensions settings above.
      • Display Format:

        Code:
        <img src="{URL}" alt="{$GLOBALS['thread']['subject']}" title="{$GLOBALS['thread']['subject']}" />

        The above is for forumdisplay_thread (optional) and showthread only.

    • 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:

        HTML Code
        &ndash;

      • 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).
      • Title: Status
      • Key: af_status
      • Applicable Forums: Select the Affiliates forum
      • Input Field Type: Listbox
      • Display Order: 6
      • Editable by / Required Field? Administrator
        Modify it as our needs.
      • Values List:

        Code:
        1{|}Approved
        2{|}Pending
        3{|}Expired
        4{|}Rejected

      • Field Input Width: 20
      • Field Input Height: 1
      • Blank Replacement Value:

        HTML Code
        <strong style="color:orange;">Pending</strong>

        All new proposal of new affiliates should be set to Pending.

      • Formatting Map List:

        HTML Code
        1{|}<strong style="color:green;">Approved</strong>
        2{|}<strong style="color:orange;">Pending</strong>
        3{|}<strong>Expired</strong>
        4{|}<strong style="color:red;">Rejected</strong>

      • Filtering Mode: Exact Match
      • Underlying Data Type: Integer (unsigned, usually 32-bit)
  • Create new templates (optional):
    • af_forumdisplay_threadlist

      HTML Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      <div class="float_left">
      	{$multipage}
      </div>
      <div class="float_right">
      	{$newthread}
      </div>
      <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder clear">
      	<tr>
      		<td class="thead" colspan="{$colspan}">
      			<div class="float_right">
      				<span class="smalltext"><strong><a href="misc.php?action=markread&amp;fid={$fid}{$post_code_string}">{$lang->markforum_read}</a> | <a href="usercp2.php?action={$add_remove_subscription}subscription&amp;type=forum&amp;fid={$fid}&amp;my_post_key={$mybb->post_code}">{$add_remove_subscription_text}</a>{$clearstoredpass}</strong></span>
      			</div>
      			<div>
      				<strong>{$foruminfo['name']}</strong>
      			</div>
      		</td>
      	</tr>
      	<tr>
      		<td class="tcat" colspan="3" width="66%"><span class="smalltext"><strong><a href="{$sorturl}&amp;sortby=subject&amp;order=asc">{$lang->thread}</a> {$orderarrow['subject']} / <a href="{$sorturl}&amp;sortby=starter&amp;order=asc">{$lang->author}</a> {$orderarrow['starter']}</strong></span></td>
      		<td class="tcat" align="center" width="7%"><span class="smalltext"><strong><a href="{$sorturl}&amp;sortby=tf_af_status&amp;order=desc">{$lang->af_status}</a> {$orderarrow['tf_af_status']}</strong></span></td>
      		<td class="tcat" align="center" width="7%"><span class="smalltext"><strong><a href="{$sorturl}&amp;sortby=tf_af_views&amp;order=desc">{$lang->views}</a> {$orderarrow['tf_af_views']}</strong></span></td>
      		{$ratingcol}
      		<td class="tcat" align="right" width="20%"><span class="smalltext"><strong><a href="{$sorturl}&amp;sortby=lastpost&amp;order=desc">{$lang->lastpost}</a> {$orderarrow['lastpost']}</strong></span></td>
      		{$inlinemodcol}
      	</tr>
      	{$selectall}
      	{$announcementlist}
      	{$threads}{$nullthreads}
      	<tr>
      		<td class="tfoot" align="right" colspan="{$colspan}">
      			<form action="forumdisplay.php" method="get">
      				<input type="hidden" name="fid" value="{$fid}" />
      				<select name="sortby">
      					<option value="subject"{$sortsel['subject']}>{$lang->sort_by_subject}</option>
      					<option value="lastpost"{$sortsel['lastpost']}>{$lang->sort_by_lastpost}</option>
      					<option value="starter"{$sortsel['starter']}>{$lang->sort_by_starter}</option>
      					<option value="started"{$sortsel['started']}>{$lang->sort_by_started}</option>
      					{$ratingsort}
      					<option value="replies"{$sortsel['replies']}>{$lang->sort_by_replies}</option>
      					<option value="views"{$sortsel['views']}>{$lang->sort_by_views}</option>
      				</select>
      				<select name="order">
      					<option value="asc"{$ordersel['asc']}>{$lang->sort_order_asc}</option>
      					<option value="desc"{$ordersel['desc']}>{$lang->sort_order_desc}</option>
      				</select>
      				<select name="datecut">
      					<option value="1"{$datecutsel['1']}>{$lang->datelimit_1day}</option>
      					<option value="5"{$datecutsel['5']}>{$lang->datelimit_5days}</option>
      					<option value="10"{$datecutsel['10']}>{$lang->datelimit_10days}</option>
      					<option value="20"{$datecutsel['20']}>{$lang->datelimit_20days}</option>
      					<option value="50"{$datecutsel['50']}>{$lang->datelimit_50days}</option>
      					<option value="75"{$datecutsel['75']}>{$lang->datelimit_75days}</option>
      					<option value="100"{$datecutsel['100']}>{$lang->datelimit_100days}</option>
      					<option value="365"{$datecutsel['365']}>{$lang->datelimit_lastyear}</option>
      					<option value="9999"{$datecutsel['9999']}>{$lang->datelimit_beginning}</option>
      				</select>
      				{$prefixselect}
      				{$gobutton}
      			</form>
      		</td>
      	</tr>
      </table>
      <div class="float_left">
      	{$multipage}
      </div>
      <div class="float_right" style="margin-top: 4px;">
      	{$newthread}
      </div>
      <br class="clear" />
      <br />
      <div class="float_left">
      	<div class="float_left">
      		<dl class="thread_legend smalltext">
      			<dd><span class="thread_status newfolder" title="{$lang->new_thread}">&nbsp;</span> {$lang->new_thread}</dd>
      			<dd><span class="thread_status newhotfolder" title="{$lang->new_hot_thread}">&nbsp;</span> {$lang->new_hot_thread}</dd>
      			<dd><span class="thread_status hotfolder" title="{$lang->hot_thread}">&nbsp;</span> {$lang->hot_thread}</dd>
      		</dl>
      	</div>
      	<div class="float_left">
      		<dl class="thread_legend smalltext">
      			<dd><span class="thread_status folder" title="{$lang->no_new_thread}">&nbsp;</span> {$lang->no_new_thread}</dd>
      			<dd><span class="thread_status dot_folder" title="{$lang->posts_by_you}">&nbsp;</span> {$lang->posts_by_you}</dd>
      			<dd><span class="thread_status lockfolder" title="{$lang->locked_thread}">&nbsp;</span> {$lang->locked_thread}</dd>
      		</dl>
      	</div>
      	<br class="clear" />
      </div>
      <div class="float_right" style="text-align: right;">
      	{$inlinemod}
      	{$searchforum}
      	{$forumjump}
      </div>
      <br class="clear" />
      {$inline_edit_js}

    • af_forumdisplay_thread

      HTML Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      <tr class="inline_row">
      	<td align="center" class="{$bgcolor}{$thread_type_class}" colspan="2" width="1%">{$GLOBALS['threadfields']['af_banner']['value']}</td>
      	<td class="{$bgcolor}{$thread_type_class}">
      		{$attachment_count}
      		<div>
                <span>{$prefix} {$gotounread}{$thread['threadprefix']}<span class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}"><a href="{$thread['threadlink']}">{$thread['subject']}</a></span>{$thread['multipage']}</span>
      			<div class="author smalltext">{$thread['profilelink']}</div>
      		</div>
      	</td>
      	<td align="center" class="{$bgcolor}{$thread_type_class}">{$threadfields['af_status']}</td>
      	<td align="center" class="{$bgcolor}{$thread_type_class}">{$threadfields['af_views']}/{$threadfields['af_limit_views']}</td>
      	{$rating}
      	<td class="{$bgcolor}{$thread_type_class}" style="white-space: nowrap; text-align: right;">
      		<span class="lastpost smalltext">{$lastpostdate}<br />
      		<a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}</span>
      	</td>
      {$modbit}
      </tr>

  • 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):

    PHP Code:
    $mnxt_af_fid = 7;// Forum ID for XThreads Affiliates forum.
    


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.


Attached File(s)
.7z  inc.7z (Size: 2.16 KB / Downloads: 413)

11-16-2015 06:52 AM
Find all posts by this user Quote this message in a reply
Greig Offline
Junior Member
**
Posts: 16
Joined: Nov 2015
Post: #2
RE: Affiliates
Going to implement this soon Smile Thank you.

Forum Lair: http://www.forumlair.com
The exciting hybrid community!
11-18-2015 02:06 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: