Jump to content

Theme customization: how to add token flow table in member profile area

Recommended Posts

KVS provides many different functionality around tokens, here is a brief summary.

Users can get tokens via:

  • Buying tokens for money using billings (e.g. buy 100 tokens for $1.00) for later use inside KVS. Not all billings support them: Segpay, Paypal, Verotel, Crypto.
  • Getting tokens for activity, see Activity awards section in Settings -> Memberzone settings in KVS admin panel (e.g. get 10 tokens for each 1 approved comment and etc).
  • Selling premium access to their videos, or albums, or channels, or the whole profile (this should be adjusted in templates, as by default no themes support ability for users to specify price for their content or profile).
  • Involving traffic to their videos on your site, e.g. upload some videos and refer them on their other sites, or social networks and engage some new visitors to your site, they can earn N tokens for M number of unique views, see in Settings -> Memberzone settings (for example, 100 tokens for each 100 unique view on each their video).
  • Inviting other users in paid conversions.
  • Receiving donations.

Users can spend tokens on:

  • Purchasing access to other videos, albums, channels (then have access to all videos of that channel) or profiles (them have access to all videos and albums of that profile).
  • Giving tips / donations to other users (need template changes, not supported in any themes).
  • Spending tokens on conversations via internal messenger, e.g. pay 1 token for each 1 message.
  • Receiving payouts from you in real money, if you want to pay money for their activity or content.

KVS default theme only supports certain subset of these features, because it is not possible to include all features into one theme, many features are designed for different types of sites. Theme supports purchasing videos and albums for tokens, showing token balance, ability to purchase tokens for money via payment processors, e.g. something you actually need for a PPV paysite. Theme doesn't support displaying token flow (e.g. table that explains how many token awarded for each activity or content sale), doesn't support ability to specify price in tokens for content, doesn't support ability to purchase access to channels or profiles, doesn't support donations, and doesn't support payouts (displaying list of payouts with information of how much tokens and $$$ was paid and when).

There are other guides for adding some functionality related to tokens:



This guide will provide basic steps to display token inflow and outflow at the member's profile. Please note some of its functionality needs at least KVS 6.1.0 version, which is still under development at the moment of writing.


This GUI provides 3 filters:

  • Filter by 4 possible token flows (Token spending, token buying, awards and payouts).
  • Filter by month to show only token transactions happened in that month (for the last 12 months).
  • Filter by payout, to see which payouts happened in the past (up to 10 latest). Here you can see all the awards that were paid to you in any specific payout, plus you can filter awards that are not paid yet and are due to be paid in future.


Step 1. In Website UI -> Language files -> Default language add the following block of texts:

memberzone.tokens_group.0 = Token flow
memberzone.tokens_group.1 = Spent tokens
memberzone.tokens_group.2 = Purchased tokens
memberzone.tokens_group.3 = Awards
memberzone.tokens_group.4 = Paid tokens
memberzone.tokens_group.5 = Donations

memberzone.tokens_label_period = Period
memberzone.tokens_label_payout = Payout
memberzone.tokens_label_payout_unpaid = Not paid yet
memberzone.tokens_label_payout_title = Payout %1%
memberzone.tokens_label_payout_title_in_progress = (in progress)
memberzone.tokens_label_payout_title_paid = (paid)

memberzone.tokens_label_action = Action
memberzone.tokens_label_tokens = Tokens
memberzone.tokens_label_info = Info
memberzone.tokens_label_info_deleted = The object has been deleted
memberzone.tokens_label_date = Date

memberzone.tokens_flow_types.purchase_video = Video purchased
memberzone.tokens_flow_types.purchase_album = Album purchased
memberzone.tokens_flow_types.purchase_dvd = Channel subscription purchased
memberzone.tokens_flow_types.purchase_user = Member subscription purchased
memberzone.tokens_flow_types.purchase_access_package = Premium access purchased
memberzone.tokens_flow_types.purchase_tokens = Tokens purchased
memberzone.tokens_flow_types.purchase_messages = Internal messages paid
memberzone.tokens_flow_types.award_signup = Signup award
memberzone.tokens_flow_types.award_login = Login award
memberzone.tokens_flow_types.award_avatar = Avatar upload award
memberzone.tokens_flow_types.award_cover = Cover upload award
memberzone.tokens_flow_types.award_comment = Comment submit award
memberzone.tokens_flow_types.award_video_upload = Video submit award
memberzone.tokens_flow_types.award_album_upload = Album submit award
memberzone.tokens_flow_types.award_post_upload = Post submit award
memberzone.tokens_flow_types.award_video_sale = Your video sold
memberzone.tokens_flow_types.award_album_sale = Your album sold
memberzone.tokens_flow_types.award_user_sale = Your subscription sold
memberzone.tokens_flow_types.award_dvd_sale = Your channel subscription sold
memberzone.tokens_flow_types.award_referral = Your referral revenue
memberzone.tokens_flow_types.award_donation = You were donated
memberzone.tokens_flow_types.award_video_traffic = Your video views
memberzone.tokens_flow_types.award_album_traffic = Your album views
memberzone.tokens_flow_types.award_embed_traffic = Your video embedded
memberzone.tokens_flow_types.award_messages = Your earning from messages
memberzone.tokens_flow_types.payout = You were paid out
memberzone.tokens_flow_types.donation = You've donated


Step 2. In Website UI -> Pages open [Memberzone] My Profile page for editing and put the following line into its template code somewhere under <div class="main-container-user">. This DIV renders a list of different blocks (e.g. profile info, fav videos and etc.), so you need to choose where you want token flow to be located on the page structure:

{{insert name="getBlock" block_id="list_members_tokens" block_name="My Tokens"}}

Save the changes.


Step 3. Locate the newly created My Tokens block on this page and open it for editing. Under Block parameters enable these:

  • items_per_page = 10 (or whatever number of items you want to be displayed at a time)
  • var_from = from_tokens
  • sort_by = Date
  • var_flow_group = group
  • var_date_from = date_from
  • var_date_to = date_to
  • var_payout_id = payout_id
  • redirect_unknown_user_to = /?login

Put the following code into its block template:

{{assign var="list_tokens_title" value=$lang.memberzone.tokens_group.$flow_group|default:$lang.memberzone.tokens_group.0}}
{{if $payout.payout_id}}
	{{assign var="payout_title" value=$payout.added_date|date_format:"%Y-%m-%d"}}
	{{assign var="list_tokens_title" value=$lang.memberzone.tokens_label_payout_title|replace:"%1%":$payout_title}}
	{{if $payout.status_id==1}}
		{{assign var="list_tokens_title" value="`$list_tokens_title` `$lang.memberzone.tokens_label_payout_title_in_progress`"}}
	{{elseif $payout.status_id==2}}
		{{assign var="list_tokens_title" value="`$list_tokens_title` `$lang.memberzone.tokens_label_payout_title_paid`"}}
{{elseif $payout_unpaid==1}}
	{{assign var="list_tokens_title" value=$lang.memberzone.tokens_label_payout_unpaid}}

<div id="{{$block_uid}}">
	<div class="headline">

		{{if count($payouts)>0}}
			<div class="sort">
				<span class="icon type-sort"></span>
					{{if $payout.payout_id}}
					{{elseif $payout_unpaid==1}}
				<ul id="{{$block_uid}}_payout_list">
					{{if $payout.payout_id || $payout_unpaid==1}}
							<a data-action="ajax" data-container-id="{{$block_uid}}_payout_list" data-block-id="{{$block_uid}}" data-parameters="payout_id:">{{$lang.memberzone.tokens_label_payout}}</a>
					{{if $payout_unpaid!=1}}
							<a data-action="ajax" data-container-id="{{$block_uid}}_payout_list" data-block-id="{{$block_uid}}" data-parameters="payout_id:0">{{$lang.memberzone.tokens_label_payout_unpaid}}</a>
					{{foreach from=$payouts item="item" name="payouts"}}
						{{if $item.payout_id!=$payout.payout_id && $smarty.foreach.payouts.iteration<=10}}
								<a data-action="ajax" data-container-id="{{$block_uid}}_payout_list" data-block-id="{{$block_uid}}" data-parameters="payout_id:{{$item.payout_id}}">{{$item.added_date|date_format:"%Y-%m-%d"}}</a>
		<div class="sort">
			<span class="icon icon-calendar"></span>
				{{if $date_from}}
			<ul id="{{$block_uid}}_period_list">
					<a data-action="ajax" data-container-id="{{$block_uid}}_period_list" data-block-id="{{$block_uid}}" data-parameters="group:{{$flow_group}};date_from:;date_to:">{{$lang.memberzone.tokens_label_period}}</a>
				{{section name="calendar" start=0 loop=12}}
					{{assign var="month1" value=$smarty.section.calendar.index}}
					{{assign var="month2" value=$smarty.now|date_format:"%m"}}
					{{assign var="year1" value=$smarty.now|date_format:"%Y"}}
					{{assign var="month1" value=$month2-$month1}}
					{{if $month1<1}}
						{{assign var="month1" value=$month1+12}}
						{{assign var="year1" value=$year1-1}}
					{{assign var="month2" value=$month1+1}}
					{{assign var="year2" value=$year1}}
					{{if $month2>12}}
						{{assign var="month2" value=$month2-12}}
						{{assign var="year2" value=$year2+1}}
					{{if $month1<10}}
						{{assign var="month1" value="0`$month1`"}}
					{{if $month2<10}}
						{{assign var="month2" value="0`$month2`"}}
					{{assign var="period_from" value="`$year1`-`$month1`-01"}}
					{{assign var="period_to" value="`$year2`-`$month2`-01"|strtotime}}
					{{assign var="period_to" value=$period_to-86400}}
					{{assign var="period_to" value=$period_to|date_format:"%Y-%m-%d"}}
					{{if $period_from!=$date_from}}
							<a data-action="ajax" data-container-id="{{$block_uid}}_period_list" data-block-id="{{$block_uid}}" data-parameters="group:{{$flow_group}};date_from:{{$period_from}};date_to:{{$period_to}}">{{$year1}}-{{$month1}}</a>
		<div class="sort">
			<span class="icon type-sort"></span>
			<ul id="{{$block_uid}}_group_list">
				{{section name="groups" start=0 loop=5}}
					{{assign var="group" value=$smarty.section.groups.index}}
					{{if $flow_group!=$group}}
							<a data-action="ajax" data-container-id="{{$block_uid}}_group_list" data-block-id="{{$block_uid}}" data-parameters="group:{{$group}};date_from:{{$date_from}};date_to:{{$date_to}}">{{$lang.memberzone.tokens_group[$group]}}</a>

	<div class="box">
		<div class="list-tokens">
			{{if count($data)>0}}
				<table width="100%">
					{{foreach item="item" from=$data}}
								{{if $item.object_info!=''}}
								{{elseif $item.object_id>0}}
								{{if $item.notes!=''}}
							<td>{{$item.date|date_format:"%Y-%m-%d %H:%M:%S"}}</td>
				<div class="empty-content">{{$lang.common_list.no_data}}</div>

	{{assign var="pagination_custom_parameters" value="group:`$flow_group`;payout_id:`$payout.payout_id`;date_from:`$date_from`;date_to:`$date_to`"}}
	{{include file="include_pagination_block_common.tpl"}}


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...