User Badges v1.0.3

Release Notes

This plugin allows users to be automatically awarded a badge based on a configurable number of user points (requires the User Points plugin). Additionally, badges can be manually assigned by an administrator and locked so that the badge will not change as points are gained or lost.

 

The badges are displayed on the lower right hand corner of the users icon (see screenshots). This is done by overriding the default profile/icon view and adding a css overlay on the fly. For the best results you should use 16x16 icons. IconArchive has a good collection of 16x16 icons.

 

Update 1.0.3:

  • Fixes bug where a space or special characterin a users name would break the css for badge overlay.

 

Update 1.0.2:

  • Added option to lock badge at highest level i.e. badges go up but now down.
  • Added option to display the badge description along with the badge on the users profile page.

 

 

 

 

 

 

  • I don't know if anyone else has an issue with this. The Badges admin settings has a field marked Description URL:. It also says "The badge will only be clickable on the profile page and on the river.".

    However, nowhere has any badge been clickable. I have created a page explaining the badges. I paste the url to the page in that field. Nothing. No clickable nothing. Any ideas?

  • I have no idea if this is a badges issue or not. I gave a user, points using the add function in the admin area. This automatically gave the user a badge. The problem is that it listed the wrong person in the dashboard activity.

    worshiploudwas awarded the image badge for earning more than 5000 rings (10 minutes ago

    I am worshiploud and klimu was really awarded the badge not me. It should have read,

    klimu awarded the image badge for earning more than 5000 rings (10 minutes ago

    because that is what really happedned. So how do I get it to say who really got awarded the Badge next time I feel like Santa?

  • Just in case it comes up, I call my points rings. :)

  • @worshiploud

    The badge URL is broken. Also I confirmed that if an admin awards points to a user that triggers a new badge the Admin's name is displayed in the river. Should be an easy fix. I will put out an update shortly.

  • Hi, good plugin, but I have some trouble with it.

    Sometimes the badges doesnt display, it seems to be random.

    How can i fix it? thx ^^

  • Hi, a bug i noticed: the badge is displayed at the wrong place in the Simple Poll widget.& they dont appear for logged out users ^^
    Would be great if u update this nice PlugIn :)

  • @Yuji

    Actually the bug is with the poll plugin, not with badges. The poll plugin is specifying the wrong size icon. The badge is in the middle of the icon because it thinks the icon it is attaching to is a tiny icon however its actually a small icon. Edit poll/views/default/poll/listing.php abd change 'size' => 'tiny' to 'size' => 'small' and it should look just right (at least it does on my site).

     

    And for your other issue

  • @Divagater, thx it worked perfectly, I also had to edit "/www/my/mod/poll/views/default/poll/wedget.php" :)

    But there is still a problem. Guests are unable to see the badges and even users who are logged in have trouble seeing them. By the way, you didn't end your phrase: "and for your other issue?"
    ^^

  • I don't recall why but it looks like I set the access level on badges to 1 i.e. logged in users. If you want guests to see them you need to change the access level to 2. This requires a sql query and editing 1 line of code.

     

    The query to update existing badges:

    UPDATE elggentities SET access_id = 2 WHERE subtype = (SELECT id FROM elggentity_subtypes WHERE subtype = 'badge');

     

    And now edit mod/badges/actions/upload.php and change:

     

    $file->access_id = 1;

    To

    $file->access_id = 2;

     

    And that should do ya...

     

    Cheers,

     

  • Pagehandler log reporting the following error

    [15-Dec-2009 06:55:19] WARNING: Action badges/view was called without an action token. It is stongly recommended that you consider doing this. Plugin authors should use 'input/form' or pass is_action=true to 'output/confirmlink' or 'output/url'.

  • followiing up to my earler post, my error log is over 128m all full of this error. seemd i get 1 line for each time a badge is fetched. i deactivated the mod and it stopped appering.

  • @Divagater - hope you'll be updating this soon. I'd love to use it, but based on NDD's comment... I think I'll wait for the update.

    Thank you for your plugin.

  • Not sure when I will get to it. Pretty busy with other things at the moment and I don't consider a warning message in the log files very urgent bug.

  • @Divagater,  Thank you for the plugin.  I gave it a go based on your last comment.

    I see the badge on the profile page, but not anywhere else... is that the correct behaviour?

    TIA :-)

  • That would not be the correct behavior. The expected behavior is that the badge is always displayed on your the corner of your icon. This plugin overrides the icon view to overlay the badge. If you have another plugin that also overrides the icon view that could cause a conflict. The overlay is just done with css so its pretty simple. Let me know if you need some help troubleshooting.

  • This override of icon view should be taken to user_status plugin. :)

  • hi i just got this dl and i need to ask before i set up my badges, is the max number of points set to 255 by default, i awarded 2500 and it just gave me 255.   can we change that to a higher amount and where (what file) might i ask... thanks

  • nevermind it was just the admin account it affects, the other names it added all 2500 points, cool thanks, guess admin will just have to starve lol  thanks for the good work

     

  • the img tags for the badges aren't working in 1.7 due to lack of security tokens.  I'm not that familiar with how your plugin is structured, but I made some simple changes to 4 files (badges\icon.php, list.php, assign.php, profile\icon.php) to add them.  for assign and list, I added the elgg_add_action_tokens_to_url function inside the img tags.  for the icon files, I manually generated the ts and token values and appended them to the url generation for the img tags.  

    probably not the cleanest solution, but I got it working this way.

    nice plugin - thanks.

  • @kevin

    I have not tested or looked at making any of my plugins work with 1.7 yet. Been really swaped lately. I appreciate you sharing the steps you took to fix the issue you were having.

     

    Thanks,

    Billy

  • Divagater,

     

    This is a great plugin and very much what I was looking for.

     

    I used both the plugins and User Points is working perfect. But for the badges I am unable to do configuration as the  Administration panel appears as below and not as suggested on this page. What am I doing wrong? Thanks for your help.

    image

  • great plugin and looking forward to it breing compatible with 1.7

  • @Kevin Kawahara

    Can nyou explain with some details what exactly u did to make it work on 1.7

    Thanks in advance!

  • lots of people emailing me for detailed info on my changes.  since we lack a repository or blog area (or file attach!) here, and I don't want to fork the project and repost the whole plugin, I'll just summarize my changes here until the author can include a more permanent fix.  sorry for the ugly look - this box is difficult to share HTML source:

    views\default\badges\icon.php

    add ~line 3

        $ts = time();

        $token = generate_action_token($ts);

     

    replace img tag line ~23

    <img title="<?php echo $badge->title; ?>" src="<?php echo $vars['url']; ?>action/badges/view?file_guid=<?php echo $guid; ?>&__elgg_ts=<?php echo $ts; ?>&__elgg_token=<?php echo $token; ?>">

     

     

    views\default\badges\list.php

    replace line 40-47

        $html .= "<td><img src=\"";

    $html .= elgg_add_action_tokens_to_url("{$vars['url']}action/badges/view?file_guid={$entity->guid}");

    $html .= "\">";

    $html .= "</td>";

        $html .= "<td>";

        $html .= "<a href=\"{$vars['url']}mod/badges/edit.php?guid={$entity->guid}&__elgg_token=$token&__elgg_ts=$ts\">".elgg_echo('badges:edit')."</a> | ";

        $html .= elgg_view("output/confirmlink", array(

    'href' => $vars['url'] . "action/badges/delete?guid={$entity->guid}&__elgg_token=$token&__elgg_ts=$ts",

            'text' => elgg_echo('badges:delete'),

            'confirm' => elgg_echo('badges:delete:confirm')

            ));

     

     

    views\default\badges\assign.php

    replace line 9

        $label = "<img src=\"{$vars['url']}action/badges/view?file_guid={$entity->guid}\"> " . $entity->title . " - {$entity->badges_userpoints} points";

     

     

    views\default\profile\icon.php

    add line ~17

        $ts = time ();

        $token = generate_action_token ( $ts );

     

    in the css section, add to the end of each background element

    &__elgg_token=<?php echo $token; ?>&__elgg_ts=<?php echo $ts;?>

    ie

        background: url(<?php echo $vars['url']; ?>action/badges/view?file_guid=<?php echo $vars['entity']->badges_badge; ?>) no-repeat;

    becomes

    background: url(<?php echo $vars['url']; ?>action/badges/view?file_guid=<?php echo $vars['entity']->badges_badge; ?>&__elgg_token=<?php echo $token; ?>&__elgg_ts=<?php echo $ts;?>) no-repeat;

Billy Gunn

Developer @ Arck Interactive

Stats

  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 5229
  • Recommendations: 9

Other Projects

View Billy Gunn's plugins