[Elgg 1.8-1.12 & 2.X: Elggx Badges] v1.9.10

Release Notes

Changelog:

  • Updated version 1.8.10 for Elgg 1.9 which includes the following bugfix: on manually assigning userpoints to a user that result in the badge of this user to change the river entry informing about the new badge now correctly includes this user and not the admin user who assigned the userpoints. Also the former river entry informing about the last change of badge of the user gets deleted and no longer the river entry of the admin user's last badge change. Thanks to Michele for reporting the issue.
  • Hi iionly,
    since in elgg 1.9 using alboorg theme I had some view problem I changed a couple of thing, in order to show the badge on any size of avatar icon (it solves the overlay problem and scale the badge according to icon size (badge width should be at least 80px)):

    In file: /mod/elggx_badges/views/defaults/icon/default.php changes in lines 109-140:

        switch($size) {
                    case "tiny":
                    $badge_url = elgg_get_site_url() . 'action/badges/view?' . $tokenRequest . '&file_guid=' . $vars['entity']->badges_badge;
                    $badge_style = "badge badge-$size";
                case "small":
                    $badge_url = elgg_get_site_url() . 'action/badges/view?' . $tokenRequest . '&file_guid=' . $vars['entity']->badges_badge;
                    $badge_style = "badge badge-$size";
                case "medium":
                    $badge_url = elgg_get_site_url() . 'action/badges/view?' . $tokenRequest . '&file_guid=' . $vars['entity']->badges_badge;
                    $badge_style = "badge badge-$size";
                case "large":
                    $badge_url = elgg_get_site_url() . 'action/badges/view?' . $tokenRequest . '&file_guid=' . $vars['entity']->badges_badge;
                    $badge_style = "badge badge-$size";
                    break;
                default:
                    break;
        }

        if ($guid = $vars['entity']->badges_badge) {
            $badge = get_entity($guid);
        }

        if ($badge_style) {
    ?>

            <div class="<?php echo $badge_style; ?>">

     

    In file: /mod/elggx_badges/views/defaults/badges/css.php added or modified:

    .badge{display: block;
            position: absolute;
            top: 1px;
            left: 1px;
    }

    .badge-tiny{width:10px; top:-4px;}
    .badge-small{width:15px;}
    .badge-medium{width:40px;}
    .badge-large{width:80px;}

    .elgg-avatar img{width:100%;}

    In order to show in profile the badge and its description on one line I change this:

    In file: /mod/elggx_badges/views/defaults/badges/icon.php changes in lines 17-36:

    <div class="badges_profile">
        <?php echo elgg_echo('badges:badge:upper'); ?><br>

        <?php if ($badge->badges_url) { ?>
            <a href="<?php echo $badge->badges_url; ?>">
       <?php } ?>

        <img title="<?php echo $badge->title; ?>" src="<?php echo elgg_get_site_url(); ?>action/badges/view?file_guid=<?php echo $guid . $tokenRequest; ?>">

        <?php if ($badge->badges_url) { ?>
            </a>
        <?php } ?>

        <?php if ((int)elgg_get_plugin_setting('show_description', 'elggx_badges')) { ?>
           <div class="badges_profile_description"><?php echo $badge->description; ?></div>
        <?php } ?>

    </div>

    In file: /mod/elggx_badges/views/defaults/badges/css.php added or modified:

    .badges_profile img{
        float:left;
        margin-right: 10px;
        width: 50px;
    }

    .badges_profile_description {
        font-weight: lighter;
        font-size: small;
        line-height: 100%;
        text-align: justify;
    }

  • I forgot to mention that you have to extend css/admin in order it to work also in admin area:


        elgg_extend_view('css/admin', 'badges/css');

  • @Teo: thanks! I have to test this out. Does it also work with the default theme and your changes? I realized last week (with another plugin) that getting 3rd party plugins to look right on Elgg 1.9 both for the default theme and Aalborg theme might be a problem...

  • It seems it works fine on default theme too.

    When I upload a badge, where is its image saved on the server? It seems that if I want to change the image I have to delete the old badge and upload a new one. If I knew tis location on the server I can overwrite it via ftp.

    Just a curiosity: why the use of tokens? (Don't know almost anything about it)

    Teo

  • The images are saved in the data directory subfolder (image/badges) of the user who uploads the badge image.

    The token are a security requirement of Elgg core when calling an action (in this case the badge view action).

Stats

  • Category: Misc
  • License: GNU General Public License (GPL) version 2
  • Updated: 2019-2-25
  • Downloads: 6831
  • Recommendations: 28

Other Projects

View iionly's plugins