[Elgg 1.8-1.12 & 2.X: Elggx Userpoints] v1.8.7

Release Notes

Changelog:

  • Fixed awarding of points on starting a new group discussion topic and replying in a group discussion.
  • It works perfectly!! Thank you very much @iionly for the quick response and fix

  • it does! thank you this is a really good plugin : )

  • Hi iionly,

    I may have found a bug, it happened 3 times and even after upgrading to elgg 1.8.16 and this plugin's 1.8.7 I see the issue in conjunction with badges.

    If I manually add points to a user to reach the minimum level to also have him receive a new badge, the user correctly receives both points and badge but the message to the river wrongly displays admin avatar and reports a new badge to admin. I didn't notice actually if the also gets points so at least the river message seems wrong maybe also points added to admin.

    Cheers

  • @Michele: sounds like a bug. I guess the problem is within the Badges plugin and not the Userpoints plugin. I will have to test it to be sure but I think the userpoints will get awarded correctly. Most likely it's the logic within the Badges plugin that assigns the badge that is faulty in the sense of assigning the badge always to the logged in user instead of the user who actually received the points because the possibility of manually assigning of points to a user by the admin was simply not taken into account. Let's see if I can fix it...

  • i have a problem when i delete people i get this error

     Unsupported operand types in /home/user/public_html/ssite.com/mod/elggx_userpoints/start.php on line 293

  • There's a metadata field added to the user entities by the userpoints plugin to save the current number of userpoints of this user. The error you see is caused by the value saved in this field being invalid (not a number and therefore not the current number of points of this user). Of course, it should not happen that the metadata field gets invalid but sometimes it happens nonetheless (my guess is due to some server glitches). A sign that something is wrong with the metadata field is that instead if the number of points "Array" is displayed on a profile page.

    The userpoints plugin has an option on its settings page to restore the metadata field value (by re-calculating the number of points gained based on existing content entities of this user account). You can also let the metada fields of all user accounts re-calculated. So, if account deletion fails, you should restore the metadata field of this account first and then retry.

  • i see i will try that thank you : ) retore meta data 

  • i tried still shows error when i delete a user or other actions, for now i delted line 293 will that be ok?

  • Without line 293 the number of userpoints shown for your users on your site will no longer get updated when they get new userpoints.

    Does the user account get deleted when the error occurs or not? If not, what is shown on the profile page below of the profile image area where the number of userpoints should be shown? Do you see the word "Array" instead of the number of userpoints? If that's the case, does restoring the userpoints changes anything?

  • oh i see, the user account does not get deleted and i get a fatal error line 293 start.php on this plugin, i did before get array and when i restored i had 3099 user points only had 400 before i will download this plugin again and try using 1.8.1.6

  • all fixed now thanks to your advice above  : )

  • Works perfectly. A suggestion: A small icon/image that beside or above the text in the user profile.

  • @Nefea: I'm afraid I don't fully understand what you are suggesting. What kind of image / what purpose do you have in mind? If you only have a static image/icon in mind (same image for all users), you could modify elggx_userpoints/views/default/elggx_userpoints/icon.php accordingly for the image to be displayed or modify the userpoints_profile class in elggx_userpoints/views/default/elggx_userpoints/css.php. If you have something different in mind there might be other changes necessary but I have no idea what you do have in mind then.

  • Instead of the text point, a small image of something or a choice of text or image.

    Another thing, being the admin my point show up in an odd way. The points I give myself show up as - 1000. Maybe an option to give choosen members unlimited points that doesn't show on their profile?

  • Nefea, what you mean is already made by the same author, Elggx badges and it works perfectly together with the userpoint plugin.

    http://community.elgg.org/plugins/834800/1.8.10/elgg-1819-elggx-badges

  • @Nefea As I said, you can modify elggx_userpoints/views/default/elggx_userpoints/icon.php according to your needs, if you want an image instead of the number of points or in addition to the number of points respectively to be displayed. I don't see any sense in replacing the number of points by a image though. After all the users should be able to see how many points they have, shouldn't they? Therefore, I won't make such a modification in the code in the published version of the Userpoints plugin. Likewise, an image in addition to the number of points is something that seems not something that is really necessary for everyone. Starting with the selection of the image already this seems rather something that will not fit every site. As I said, if you want to have this on your site, you can modify elggx_userpoints/views/default/elggx_userpoints/icon.php to your liking.

    Regarding manual adding of points I can't see any issues when awarding the points to myself. It shows the updated number of points on my profile page as expected. An "unlimited" number of points for certain users is not possible. The metadata entry in the database must always be a number within the allowed numerical range (even if the number is very, very large). The only way I can think of to simulate an unlimited number would be by adding a plugin hook handler that sets/resets a user's userpoints to a predefined number for example at login or when the user's gains or loses points. Sounds much like cheating to me though. If you think you need such a feature I'm afraid you will have to implement it on your own though. The plugin hook handler approach should work even if I can't explain it in every detail.

  • @driesdk: thanks. Maybe that's the solution. I wasn't aware that Nefea might have badges in mind as it sounded to me he wanted rather a static image - and I did ask for more details. If he would have said "images to be displayed depending on the number of points" most likely even I would have understood. :-)

  • @iionly I would like to award users for adding an object of my custom entity. How may I do this please?

  • @Ryan: take a look at mod/elggx_userpoints/views/default/elggx_userpoints/actions.php. This view contains the configuration of the plugin settings that correspond to awarding of userpoints. In case of an object with subtype "custom_subtype" you would have to add a new plugin setting here:

    <tr>
            <td width="40%"><label><?php echo elgg_echo('userpoints_standard:custom_subtype'); ?></label></td>
            <td><?php echo elgg_view('input/text', array('name' => "params[custom_subtype]", 'value' => $plugin->custom_subtype)); ?></td>
        </tr>

        <tr><td>&nbsp;</td><td>&nbsp;</td></tr>

    So, subtype of object = name of plugin setting. Then you need to add the label 'userpoints_standard:custom_subtype' to the language file and you're done. You can configure the number of points to be awarded on object creation in the usual way and it should work.

  • Hi,

    I also go this error

    [Thu Feb 27 11:11:09 2014] [error] [client 81.30.38.67] PHP Fatal error: Unsupported operand types in /home/sites/site40042/subdomains/intra/mod/elggx_userpoints/start.php on line 293

    Can you put some error handling code in start.php so that the corrupted data will not influence the sites behaviour?

  • @Tauvic: I can try but I can't say if it will work. The problem is that I was never able to reproduce this issue so far, so it kind of difficult to implement a catch for the error.

  • @iionly - Worked like magic! Amazingly simple. Thanks :)

  • Your plugin is great. @iionly, how can I add the top users to the custom index?

    Thanks.

  • @Tokiso: in case you use the Widget Manager plugin also for configuring the index page of your site (instead of configuring it with the custom_index plugin) the Userpoints plugin already comes with an index page widget you can select.

    In case you don't use the Widget Manager plugin you can add the following code at the approriate place in mod/custom_index/views/default/page/layouts/custom_index.php to add a toppoints widget to your index page. Appropriate place means you have to decide in with column and at which position the widget should be added.

    // elggx_userpoints toppoint users
    if (elgg_is_active_plugin('elggx_userpoints')) {
        $limit = 10;
        $options = array('type' => 'user', 'limit' => $limit, 'order_by_metadata' =>  array('name' => 'userpoints_points', 'direction' => DESC, 'as' => integer));
        $options['metadata_name_value_pairs'] = array(array('name' => 'userpoints_points', 'value' => 0,  'operand' => '>'));
        $entities = elgg_get_entities_from_metadata($options);

        $html = '';

        foreach ($entities as $entity) {
            $icon = elgg_view_entity_icon($entity, 'small');
            $branding = (abs($entity->userpoints_points) > 1) ? elgg_echo('elggx_userpoints:lowerplural') : elgg_echo('elggx_userpoints:lowersingular');
            $info = "<a href=\"{$entity->getURL()}\">{$entity->name}</a><br><b>{$entity->userpoints_points} $branding</b>";
            $html .= elgg_view('page/components/image_block', array('image' => $icon, 'body' => $info));
        }

        echo elgg_view_module('featured',  elgg_echo('elggx_userpoints:toppoints'), $html, $mod_params);
    }

Stats

  • Category: Misc
  • License: GNU General Public License (GPL) version 2
  • Updated: 2019-4-7
  • Downloads: 11895
  • Recommendations: 50

Other Projects

View iionly's plugins