How to create statistics?

Dominik L Posted in General Discussion 5 months ago

hello is there any component which enables a statistic function so I can create a statistic over users and their different ages etc?

I have an age restriction on my website, and would like to check, if there are people above the age limit, from time to time

Any ideas?

Replies
German Dominik L Replied 5 months ago

Thanks, I'll try

Indonesian Arsalan Shah Replied 5 months ago

You can check people above age like this

$age_limit         = 30; //larger or equal to this 
$users             = new OssnUser();
$entity_pair_check = array(
        array(
                'name'   => 'birthdate',
                'value'  => true,
                'wheres' => "DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), STR_TO_DATE(emd0.value, '%d/%m/%Y'))), '%Y')+0 >= {$age_limit}",
        ),
);
$list = $users->searchUsers(array(
        'entities_pairs' => $entity_pair_check,
));
$count = $users->searchUsers(array(
        'count'          => true,
        'entities_pairs' => $entity_pair_check,
));

If you want this in form a component with a page that admin can search users with specific age and larger you can contact us for custom work.
A page contain a age box and search button. Which will list users for that age and >