Profile Update and Elggx Userpoints

I am using the elggx_userpoints plugin and would like to make further modifications and could use some help.

Right now, whenever a member clicks on 'Save' on their Edit Profile page, it triggers the profileupdate event, and that event triggers the userpoints being awarded. The issue is that even if the profile fields haven't really been updated, or even if they are all still empty, the event is still triggered and they still get points.

So I want to add a function that checks that the profile fields have actually been updated and, after some research, think that the best way of doing this might be to check if any of the rows in the database have been edited -- but I'm not sure how to do that.

Should I query the database directly? Or is there an existing function I can use to check? I tried looking in the lib but didn't see an existing function to call.

I'm still pretty new to PHP (about 1 year experience) and very new to Elgg (less than 6 months experience), so any help is much appreciated!

This is the function in the elggx_userpoints plugin now that adds the points if the profile has been updated. I modified it here to also check if the value of $row_updated is set to 1. Now I think that I just need to figure out how to check if the value of $row_updated is 1 or 0 :/

function elggx_userpoints_profile ($event, $type, $object) {

    if ($row_updated = 1 && $points = elgg_get_plugin_setting('profileupdate')) {

        if (function_exists('userpoints_add')) {
            userpoints_add(elgg_get_logged_in_user_guid(), $points, $event, $type, $object->entity_guid);



  • I moved this question to the Beginning Developers Forum because I realized that it relates to Plugin Modifications and that might be a better place for it.



  • I'm afraid it might not be possible to check if profile info has changed or not. The profile info is saved as metadata and the metadata table only has a time_created but no time_updated column. Each time you click on the save button of the edit profile page all metadata will be getting the current timestamp as new time_created regardless if the field content has changed or not. So, there's no way to check if any info has been alterered or not.

    The reason there are points awarded even if there's no profile info is entered at all is because there's no check if all profile fields (execpt the display name field) are empty or not but the profileupdate hook is always triggered. While for each profile field there's a separate check if any content has to be added to the database there's no overall stat if at least a single field has content or not. This would be possible by adding a stats variable (type bool) initiated false and getting set true if metadata is created. After processing the profile fields the hook could be triggered or not depending on the stat variable. Maybe you want to open an issue at github about this suggesting an update in Elgg core?