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

Release Notes

IMPORTANT: THIS IS A BETA RELEASE!!! Use on productive sites on your own risk !!! You have been warned!!!

Changelog:

  • A fix needed for the Gifts plugin to work (or all other plugins that want to use the functions userpoints_exists() and userpoints_get()).

TODO:

  • Thorough testing (also with 3rd party plugins as soon as they are available or I've managed to port them to Elgg 1.8)...
  • @iionly once again, amazing mod.

    I have a few suggestions if you consider for future develpment:

    1. If you have for example over 1000 point, it should say 1K, the reason is over time imagine users have 100,000s point for their activities and so on.

    2. If you can insert something that allows users to display their points elsewhere eg. their blogs, facebook, twitter and so on. This way the user will promote your site and also gets more involved to get more points. Others will see the the points which is pointing to users profile and they click it, voila you got new users for free.

    3. If someone assigns for example the first 5 users that reach 500 points will receive cash or an actual gift (a keyboard) and after the 5 people the rest of users get nothing, but just points.  This way admins can set the limit for gifts/cash and also set the number of users that will receive it.  The sites will get busy and users will try to achieve the prices, hence activity will increase on ones site.

    Hope you consider these point.

     

    Thanks again for the great mod.

  • This is great, thank you for the work...

     

    One question, maybe a dumb one, is there a way to list the top point earners on the front / homepage? (Yes, asked similiar question for the badge plugin as well so either/or...)

  • @Solcjoye:

    If you use the custom_index plugin for your index page, you could add the following lines in custom_index/views/default/page/layouts/custom_index.php:

    // userpoints toppoints
    if (elgg_is_active_plugin('elggx_userpoints')) {
        $lowerplural   = elgg_get_plugin_setting('lowerplural', 'elggx_userpoints');
        $lowersingular = elgg_get_plugin_setting('lowersingular', 'elggx_userpoints');
        $limit         = elgg_get_plugin_setting('numtoppoints', 'elggx_userpoints');

        $limit = $limit ? $limit : 5;

        $meta_array = array(array('name' => 'userpoints_points', 'operand' => '>', 'value' => 0));
        $entities = userpoints_get_entities_from_metadata_by_value($meta_array, 'user', '', false, 0, 0, $limit, 0, 'v1.string + 0 DESC', 0);

        $html = '';

        foreach ($entities as $entity) {

            $icon = elgg_view_entity_icon($entity, 'small');

            $branding = (abs($entity->userpoints_points) > 1) ? $lowerplural : $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("Toppoints"), $html, $mod_params);
    }

    It's maybe not very elegant but it should work.

    @fareed:

    If it would only display 1k, 2k etc. once a user gets beyond 1000 points it would look a bit strange when all the top users have for example 1k points in the toppoints list. How to see the difference in the exact number of points?

    Connecting the points standing of a user with an external site (blog, twitter, facebook) is a bit above the scope of this plugin. It surely is an interesting idea. I once was at Ning and they offered a personalized banner people could embed in their sites. Maybe that would be an idea for another plugin? Kind of a banner link with some user stats overlay. I'll keep that in mind.

    The "real" gift/cash is also a bit beyond the scope of this plugin. It would require the users to give information about their address/bank account/paypal account etc. at least to the site admin. How to deal with the sending process once a user reaches the specified number of points? With the many possibilities of which online shop to choose, the actual gift, the payment methods etc., you would need to do that as admin yourself anyway. So maybe it would be easier to just announce such contests for example via a site news message, then keeping an eye on the userpoint stats and after a user reached such a goal ask him via PM for the information where to send the gift/cash to. Maybe an automatic trigger to inform the admin about users reaching a certain number of points could be included to keep that easier. For this task, the Badges plugin could also be used. It will trigger at pre-defined number of userpoints, assign the user a badge and also creates an entry in the river.

  • Iionly: Wow, that amazingly worked (Not amazing that you figured it out...obviously you know what you are doing...) amazing that I cut and paste it and edited a slight bit, and that is STILL works perfectly well, THANK YOU VERY MUCH! :)

  • Can I have the updated version of "list the top point earners on the front / homepage? (Yes, asked similiar question for the badge plugin as well so either/or...)"

  • @SksLink: to show the toppoint users on the frontpage/homepage you need to modify the customindex plugin (or the plugin you use to create the frontpage) as I outlined above. You won't need an updated version of the userpoints plugin to achive this. Showing the latest badges awared to users might work in a similar way though I can't give the exact code at the moment without trying this out first.

  • hey iionly, thing i found a lil prob, whenyou try deleting  file, it cant be deleted wen this plugin is enable... it loads the page then stop...

  • @Flexx: I just tried to reproduce the error when deleting a file but it worked for me (Elgg 1.8.3 and latest version of Elggx Userpoints). What version of Elgg are you using? Do you have other 3rd party plugins installed and enabled that might result in the error when deleting a file? Does it happen when deleting a file both as admin and normal user? Does the number of userpoints get reduced (in case you have this option enabled) when the file deletion hangs or does the points remain the same?

  • hey, iionly, i cant say yes or no to your questions as i never did that much testing, It might be cinflicting with another pugi but i wouldnt know which one at the moment.. If i get the chance ill give an update as t what cause it..

  • Great plugin! Should be the default in future Elgg distributions. ;)

    Please, how can i create an public entry in River when someone got points (plus the description, like: "You earned 5 points for making another member a friend!")? Thanks!

  • @luizzz: I don't know if it would be wise to add a river entry each time a user gets userpoints. This would result in many, many entries! If you have configured userpoints for all actions more than half of the entries would be related to userpoints: X posted a new blog post followed by "X received userpoints for posting a blog, user X logged in and received some userpoints, an entry for every single picture and video etc...

    If you want to implement it on your own, the basic implementation is not that difficult. In start.php in the add_userpoints function you can include a add_to_river call with the user guid and the entity guid. Then you need to add the view that is called by the add_to_river call. Different texts depending on the type of action might be a bit difficult to implement as the add_to_river function only allows to include subject and object guids as parameters. Therefore, you would need to implement a case statement in the river view to select the correct language tag depending on the subtype of the entity the userpoints are awarded for.

  • @iionly Thanks a lot for the explanation! In my case, userpoints are just manual entries and alerts will not occur frequently in dashboard. I will do what you suggest only in case of manual userpoints entries.

  • Hello, I'm having trouble with the expirationdate and userpoints plugins.  Ran the cronjob manually expirationdate: ok was the reply.  But the points don't update.  What am I doing wrong?  Tried it via the cronjob and has same result. Reply is OK but nothing actually happens?  Using latest versions of both plugins.

  • @andycorney: have you set the desired time intervall for points to expire: "Expire points after" on the plugin settings tab and "Expire points for pending invitations after" on the points settings tab?

  • Hello ... I sure have, both are set to 4 weeks.  Tried different options aswell.

  • The expiration / substraction of userpoints only affects userpoints gained while the "Expire points" settings in enabled but not points gained before. Can you check what happens when you set the expire interval to 1 hour for testing purpose, then do something to get userpoints, wait >1hour until either the cronjob is executed or exexuting the cronjob manually? The question is if these newly gained userpoints will expire after this 1 hour or not.

  • ahhh ... that might be the issue then.  Apologies!

     

    I'll try the 1 hour and test it later on .. thanks for your help :)

  • One quick question.

    Can admin know how many points each user gained during specific time?

    Let's say a user might be active on first couple of months but the admin wants to know who was the most active person in last month of his query.

     

  • @ali fathieh: the list of userpoints does only show the total points of userpoints gained since joining the site. It would be possible to implement listing based on filtering between a start and end date (or some fixed interval like "last week", "last month" etc.). What you would need to do is to code the view/page structure for the filtered list to show up either on the admin backend or on your site for all users to see and to provide the custom mysql query code (or code using Elgg functions) to built the content of the lists. It surely would be an interesting feature. I'll keep it in mind and might implement it when I have the time to do so.

  • iionly is there a way to show members points in activity page ore in topbar ?

    btw for some reason they don' t show in profile either (maybe missed something in settings)

    runing elgg 1.12.9 

    p.s. awesome plugin, sorry for my bad english i' m from LV

  • There's an option on the "Plugin Settings" tab to show/not show the userpoints on profile pages. Maybe you've set this option to "No". Or your site theme might override the Elgg core views for the profile pages (specifically the "icon/user/default" view) extended by the userpoints plugin to display the userpoints on profile pages. In this case you would need to figure out how to modify the code of the theme plugin to get the userpoints displayed on profile pages.

    For the user's points to be displayed in the topbar or on the sidebar (e.g. on the activity page) you would have to extend the corresponding core views (these line in the init function in start.php of the userpoints plugin)

    elgg_extend_view('page/elements/topbar','elggx_userpoints/showpoints');
    elgg_extend_view('page/elements/sidebar','elggx_userpoints/showpoints');

    with a new view saved in mod/elggx_userpoints/views/default/elggx_userpoints/showpoints.php with the content

    <?php
    
    if (($user = elgg_get_logged_in_user_entity()) && (elgg_get_context() == 'activity')) {
        echo '<span class="userpoints_profile">';
        echo elgg_echo('elggx_userpoints:upperplural') . ': ' . $user->userpoints_points;
        echo '</span">';
    }

    Here I've restricted the display to the activity page as an example by checking the context. In any case you would have to check if a user is logged in or it will fail. The way the userpoints are displayed might also not look "nice". If you want it to show differently, you would have to modify the output or the CSS class according to your liking.

  • Thank you very much the rest is piece of cake

  • HI I'm using elgg 2.2.3 and have around two hundred users on my site, one of the users user points have disappeared from their profile page and the points utilities page, I can't reset the users point or aprove their points because each time I try I get server error 500.

    What can I do?

    Please help. 

    Thanks

  • HI I'm using elgg 2.2.3 and have around two hundred users on my site, one of the users user points have disappeared from their profile page and the points utilities page, I can't reset the users point or aprove their points because each time I try I get server error 500.

    What can I do?

    Please help. 

    Thanks

Stats

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

Other Projects

View iionly's plugins