@Phil Collins
I sent you a private message yesterday. Could you please respond to that?
Thanks
@Phil: are you really sure that it has changed?
As I've tried to explain the 60% are very likely NOT "60% total available CPU resources used" but rather "60% of the CPU resources used are by pagehandler.php". And this would be a perfectly normal situation. If the site is not having any visits for example in 23h59min in a day you still would have "~60-80% CPU resources used by pagehandler.php" in the remaining 1min even if the CPU is idle for almost all day.
Almost all requests end up going through the pagehandler, so either explanation is valid. If the site is doing something to eat up resources it would still likely be reported as pagehandler.php
Unfortunately without additional details there's no good way of identifying the real issue or a solution.
Not tested the following code but it should do what you have in mind:
// Which user do you want to get the points gained today for?
$user_guid = elgg_get_logged_in_user_guid(); the user logged in
// or
$user_guid = elgg_get_page_owner_guid(); // for example the user whose profile page someone is looking at// the following line is likely to be necessary if the intention is to let another user see
// how many points the user has gained today. It disables Elgg's access management temporarily
$access = elgg_set_ignore_access(true);$points_entities = new ElggBatch('elgg_get_entities', array(
'type' => 'object',
'subtype' => 'userpoint',
'owner_guid' => $user_guid,
'created_time_upper' => time(),
'created_time_lower' => time() - 86400,
));$points_today = 0;
foreach($points_entities as $entity) {
// only considering points that have already been approved here
// if pending userpoints are to be counted up, too, the if-clause is not necessary
if ($entity->meta_moderate == 'approved') {
$points_today = (int)$points_today + (int)$entity->meta_points;
}
}// restore Elgg's access management
elgg_set_ignore_access($access);echo "Userpoints gained today: " . $points_today;
If you would include it for example in mod/elggx_userpoints/views/default/elggx_userpoints/icon.php in an appropriate way it should display the points the user gained today on the profile page.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.