Loading...
 
Skip to main content

Credits


Credits are a way for Tiki users to have different stored value types of credits. They can be points, tokens, hours, minutes, numbers of uses of something, etc. This feature comes with an API to add and use credits for each user.

Somehow, it implies having the ability to define and use multiple currencies within a single Tiki site, similarly to what can be achieved with Community Currencies linked to a CCLite server, which allows using those multiple currencies with other sites (intertrading), sites which can be powered by Tiki or other CMS/Softwares, such as Joomla, Drupal, Elgg, etc.

Credit Details

Credits have a few characteristics:

  • Credits have expiry dates and validity periods.
  • Admins can configure different credit types and you can have different credit types for different sites

Admin Credits

  • The admin panel for this feature is at tiki-admin_credits.php
    Image

  • You also need to define which TUC types are allowed in the tiki site, through "Admin home > Payments > Tiki User Credits" (tiki-admin.php?page=payment):
    Image

  • Credits are used in the order of the earliest expiration date. Credits with no expiration date are used last.


Some definitions (useful for the admin panel):

Credits page for non-Admin users (coming in Tiki 26)

Users can see their own credits in this page: tiki-user_credits.php

Add credits to users

You add credits to users through tiki-admin_credits.php?userfilter=username (being username the name of the user; which you can type in the username search boxImage

An admin can also set that a user has already consumed some of that set of allocated credits:

Image

And a report on the historical usage can be shown also:

Image

Use Credits

You can pay invoices of Tiki Payments using Tiki User Credits.

The credits that a user has left can be seen at any time by means of the module Module credits:

Image




Developer Tips


You could make use of functions in lib/credits/creditlib:

function useCredits to use up credits and function addCredits to add credits for users. Also use getCredits to get a user's credit information, and getScaledCredits which extends getCredits with more human readable information.

alias