P2014_0002

Description: 

A way to add drupal points to all users daily/weekly.

Need a way to grant points to all my users daily or weekly.
Wants to grant fixed or percentage points to all users daily or weekly

1) Add x points (fixed) to all users weekly/daily

Example : Give all users 3 points daily

2) Add x% of the users granted points (percentage) weekly/daily.

Example : Let all users accrue 1% more points from their granted points weekly.

Solution: 

$vrate = 0.01;

// Constant Rate
$crate = 5;

$users = entity_load('user');
foreach ($users as $user)
{
$current = userpoints_get_current_points($user->uid);
$params = array (
'uid' => $user->uid,
'points' => round($vrate*$current + $crate),
'description' => "Accrued",
);
userpoints_get_current_points();
userpoints_userpointsapi($params);
}

Rewards: 
100 Toints
Status: 
Concept

Comments

Abisong's picture

sss