Nats list linkcodes

From TMM Wiki
Jump to navigationJump to search
NATS 4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers
    Template Functions
nats_add_to_array
nats_adtool_replace_linkcode
nats_array_flip
nats_array_to_xml
nats_build_array_by_reference
nats_convert_bytes
nats_decode
nats_display_account_campaigns
nats_display_account_change_history
nats_display_account_notifications
nats_display_account_preview
nats_display_admin_links
nats_display_admin_message
nats_display_adtool_form
nats_display_adtool_types
nats_display_adtools
nats_display_adtools_type_limit
nats_display_choose_adtools_group
nats_display_code_info
nats_display_create_campaign
nats_display_edit_account_details
nats_display_edit_account_settings
nats_display_edit_defaults
nats_display_edit_password
nats_display_edit_payvia
nats_display_edit_payvia_info
nats_display_edit_skin
nats_display_gallery_builder
nats_display_graph
nats_display_hourly_sales
nats_display_latest_adtools
nats_display_map
nats_display_news
nats_display_page_peel
nats_display_payment_history
nats_display_payment_summary
nats_display_ratio
nats_display_reward_category
nats_display_reward_order
nats_display_reward_purchases
nats_display_signup_advanced
nats_display_signup_basic
nats_display_signup_payvia
nats_display_stats
nats_display_stats_calendar
nats_display_stats_form
nats_display_stats_referrals
nats_display_stats_retention
nats_display_stats_subscription_details
nats_display_stats_table
nats_display_timezones
nats_display_top_stats
nats_dump_data
nats_encode
nats_get_first_in_array
nats_get_payment_breakdown
nats_get_period_end
nats_get_reward_categories
nats_get_member
nats_list_adtool_groups
nats_list_affiliates
nats_list_billers
nats_list_campaigns
nats_list_linkcodes
nats_list_options
nats_get_option_details
nats_list_programs
nats_list_sites
nats_list_tool_categories
nats_list_tours
nats_list_xsells
nats_smarty_function_amount_owed
nats_smarty_function_getbonus
nats_smarty_rebuild_form
nats_smarty_rebuild_link
nats_smarty_rebuild_query
nats_tooltip
nats_track_link
nats_strack_link
tmm_admin_pagination
Template Shortcuts
add_to_array
adtool_replace_linkcode
affiliate_select_form
array_flip
array_to_xml
amount_owed
build_array_by_reference
convert_bytes
display_account_campaigns
display_account_change_history
display_account_notifications
display_account_preview
display_admin_links
display_adtool_form
display_adtool_types
display_adtools
display_adtools_type_limit
display_choose_adtools_group
display_code_info
display_create_campaign
display_gallery_builder
display_stats_referrals
display_edit_account_details
display_edit_account_settings
display_edit_defaults
display_edit_password
display_edit_payvia
display_edit_payvia_info
display_edit_skin
display_graph
display_hourly_sales
display_latest_adtools
display_map
display_news
display_page_peel
display_payment_history
display_payment_summary
display_ratio
display_reward_category
display_reward_order
display_reward_purchases
display_signup_advanced
display_signup_basic
display_signup_payvia
display_stats
display_stats_calendar
display_stats_table
display_stats_form
display_stats_retention
display_stats_subscription_details
display_top_stats
display_timezones
dump_data
get_first
get_period_end
get_reward_categories
list_billers
list_campaigns
list_linkcodes
list_options
list_programs
list_sites
list_tool_categories
list_tours
list_xsells
rebuild_form
rebuild_link
rebuild_query
reward_points
tooltip
Common Parameters
assign
assign_prefix
count
data_only
display_on_assign
start
tpl

Applies to NATS 4.0.25 and greater.

nats_list_linkcodes

Prints a list of linkcodes matching a query. (To create a single linkcode, please see the nats_encode article.)

Alias: list_linkcodes

params list:


Parameters

(Required parameters in bold)

Parameter Description Possible Values Default Value Example
tpl Template used to display output Any valid template The template, function_list_linkcodes tpl="mytemplate"
code_only Displays the linkcode as either a complete or relative URL 0 or 1 (exclusive) 0: displays entire URL code_only="1"
campaigns Return only linkcodes available to a list of campaigns. If set, ignores campaign and use_default_campaign below An array reference (see Notes section below) None. campaigns="$my_array"
campaign Return only linkcodes available to a single campaign. If set, ignores use_default_campaign below Any valid campaign number The user's current default campaign campaign="123"
use_default_campaign Return only linkcodes available to the database's stored default campaign for the current user. (See notes for arguments, campaign and campaigns, above) 0 or 1 (exclusive) None. use_default_campaign="1"
userid The user ID number to get the default campaign from Any valid user ID number The currently logged in user. userid="123"
programs Return only linkcodes available to a list of programs If set, ignores program below An array reference (see Notes section below) None. programs="$my_array"
program Returns only linkcodes available to a single program. If set, ignores use_default_program below Any valid program ID number The user's default program program="123"
use_default_program Returns only linkcodes available to the database's stored default program for the current user. (See notes for arguments, program and programs, above) 0 or 1 (exclusive) None. The default in program will apply (see program above) use_default_campaign="1"
sites Return only linkcodes available to a list of sites. If set, ignores site and use_default_site below An array reference (see Notes section below) None. sites="$my_array"
site Return only linkcodes available to a particular site. If set, ignores use_default_site below Any valid site ID number The user's default site site="123"
use_default_site Returns only linkcodes available to the database's stored default site for current user. (See notes for arguments site and sites, above) 0 or 1 (exclusive) None. The default site will apply (see site above) use_default_site="1"
tour Return only linkcodes available to a particular tour. (See note in tours below) Any valid tour ID number All tours unless tours, below, is used tour="123"
tours Return only linkcodes available to a list of tours. If set, overwrites tour above An array reference (see Notes section below) All tours unless tour, above, is used tours="$my_array"
adtool Return only linkcodes available to a particular adtool. (See note in adtools below) Any valid adtool ID number All adtools unless adtools, below, is used adtool="123"
adtools Return only linkcodes available to a list of adtools. If set, overwrites adtool above An array reference (see Notes section below) All adtools unless adtool, above, is used adtools="$my_array"
subid1 Return only linkcodes available to a particular first subid (See note in subids1 below) Any valid first sub ID number All first subids unless subids1, below, is used subid1="123"
subids1 Return only linkcodes available to a list of first subids If set, overwrites subid1 above An array reference (see Notes section below) All subids unless subid1, above, is used subids1="$my_array"
subid2 Return only linkcodes available to a particular second subid. (See note in subids2 below) Any valid second sub ID number All second subids unless subid2, below, is used subid2="123"
subids2 Return only linkcodes available to a list of second subids. If set, overwrites subid2 above An array reference (see Notes section below) All second subids unless subid2, above, is used subids2="$my_array"
count Max number of linkcodes to display Any whole number greater than zero None. Displays all matching linkcodes count="10"
assign_prefix Prefix output variables with this word. (Click link for details) Any valid Smarty variable name None. (No prefix is used) assign_prefix="myvar"
data_only Set variables but don't display the template 1 None. The template is displayed. data_only=1
show_hidden Show link codes for hidden sites. 0 or 1 (exclusive) None. Do not show hidden sites show_hidden="1"
order Change the ordering of the link codes returned by the template function (see Notes section below) s.name, t.name order="s.name, t.name"

Output

By default, displays a list of link codes using the template function_list_linkcodes. and places the linkcodes in the {$linkcodes} array. The linkcodes array contains six associatives:

  1. program I.D.
  2. site I.D.
  3. tour I.D.
  4. adtool I.D.
  5. sub I.D #1
  6. sub I.D. #2

Each linkcode will always have a program I.D., site I.D., and tour I.D.; they may have adtool and sub I.D.s. For example, the following variable contains the linkcode for the program one, site two, and tour three:

{$linkcodes.1.2.3.0.0.0}

Examples

Listing Linkcodes in an Email

Each affiliate that receives an email with the following function call will get their linkcodes for the program and site you specify.

{nats_list_linkcodes userid=$loginid data_only=1 program=program_number site=site_number}

Replace program_number with the program I.D. number. Replace site_number with the site I.D. number.

Inserting the natscode in an Emailed Tour Link

Each affiliate that receives an email with the following text and Smarty code will get the link to the tour with their natscode embedded in the URL:

URL?nats={nats_list_linkcodes userid=$toid program=program_number site=site_number 
  tour=tour_number data_only=1 code_only=1}{$linkcodes.program_number.site_number.tour_number.0.0.0}

Replace URL with the URL to the tour. Replace program_number with the program I.D. number. Replace site_number with the site I.D. number. Replace tour_number with the tour I.D. number. For a tour on example.com/tour, program number one, site number two, and tour number three, the code looks like:

http://example.com/tour?nats={nats_list_linkcodes userid=$toid program=1 site=2 tour=3 data_only=1 code_only=1}{$linkcodes.1.2.3.0.0.0}

Notes

If you are looking to add a NATS code to adtool links in an e-mail then we recommend using the nats_encode template function.

To make an array reference, create the array using the nats_add_to_array function.

You can order the link codes by site, tour and program. You can select which fields you wish to order by based on the columns available within the database table. To order by a column within the site table, you must prefix the column with 's.' (Example: order="s.siteid"). To order by the tour table, you must prefix the column with 't.' and the program table by 'p.'.

See Also