Elgg Notify addition

I know this is probably really easy but i think the developer left this plugin to die.

I just want to add the users icon next to their name in elgg notify.  On the topbar and also on the "see all notifications".

Ive been trying to add things to this file (mod/notifications/all.php but none are working.  Ive added getIcon ($size= 'medium'), nothing seems to be working

<?php

    /**
     * Elgg notifications plugin index
     *
     * @package ElggNotifications
     * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
     * @author Curverider Ltd
     * @copyright Curverider Ltd 2008-2010
     * @link http://elgg.com/
     */

    // Load Elgg framework
        require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php');
       
    // Ensure only logged-in users can see this page
        gatekeeper();
       
    // Set the context to settings
            set_context('settings');
       
           //
               
        $body = list_entities_from_metadata('to_id',$_SESSION['user']->getGUID(), 'object','notification',0,20);
               


   
    // Insert it into the correct canvas layout
        $body = elgg_view_layout('two_column_left_sidebar','',$body);
       
    // Draw the page
        page_draw(elgg_echo('notifications:subscriptions:changesettings'),$body);
       
       
?>

 

 

  • " think the developer left this plugin to die... "

    thatsh rather a mean statementz ;-) 

    what about 'the developer is most probabaly too busy with his high school exams ;-) " ?

    Mark Harding is only about 14 years old ! though he could most likely code that icon thingy is his sleep ;-P

     

  • @DhrupDeScoop

    I know mark and have worked with him in the past. He is a great coder. I meant no disrespect. I didn't think it would offend anyone. Wether "he left it alone to die" or "too busy with high school exams" he hasn't commented anyone back on his plugin.

  • Oki ;-) Forgiven, Yew just kinda sounded "off" and I usually defend my young'uns . Mark has been pretty quiet for some long time and only occasionally comes around to post some small comment(s), then disappears agin ;-) He's probably up to creating some new funky web-site after his past maestrozone.com.

    Post your whole code which doesn't work and maybe I'll look at it after midnight.. after a few more wines ;-P

  • Thanks. The code I pasted up top works (I paid mark for his services but this is outside the scope we agreed on) I just wanted to add the geticon handler but I don't really know how or where or if that's even right. Any help would be appreciated and I can paste other files I just don't know if mark would like me posting code he's done without his permission.

  • where do you want the icon to display ?

    i've not looked into tested that plugin at all ;-)

  • Oh I think I'm looking in the wrong place. I think I need to add it to the Notification handler in the "elgg notify" Parameter

    $live = "has written on your message board wwwroot . "pg/messageboard/" . $user->username . "\"> click here to see it "

    On the notifications it says "user" has written on your message Board. Click here to see it

    I just want to add the users icon in the beginning next to their name.

  • ;-)

    i think you're looking at --

    and want the senders avatar to preceed each line ?

    The ajax call --

    $("#result").load("<?php echo $vars['url']; ?>mod/notifications/ajax/data.php",function(){

    populates that area and uses this call

    list_entities_from_metadata 

    which will pre-format each notifcn

    giving no chance to patch in the avatar

    probably need to :-

    • use get_entities_from_metadata
    • traverse each element in the returned array
    • grab the sender's guid
    • form the html for the avatar
    • prepend to each row
    • and then call for formatting

    this gonna take some non-trivial coding esp if one considers themselves kinda 'junior' in elgg / php api`s

     

  • All good stuff. Again I thank you for helping me out. I need to digest all this and I will post results.

  • solution

     

    <?php

    /**

    * Elgg notify

    * @package Elgg_Notify

    * @author Mark Harding

    * @copyright Mark Harding 2010

    * @link http://marksmusiconline.co.uk/

    */

     

    global $CONFIG;

    $ts = time();

    $token = generate_action_token($ts);

     

    $notify = $vars['entity'];

         

     

    $notify_guid = $notify->getGUID();

     

    $friendlytime = friendly_time($vars['entity']->time_created);

     

    $desc = $notify->desc;

    $owner = $vars['entity']->getOwnerEntity();

    $action_user = get_entity($notify->action_user);

     

            $notify->readYet = 1;

            $notify->save();

     

     

    $url = $vars['site']->url;

     

    echo "<div class=\"notifications_content\">";

    //echo "<span id=\"notify_delete\">";

    // echo "<a href=\"{$CONFIG->url}action/notifications/delete?guid={$notify_guid}&__elgg_token=$token&__elgg_ts=$ts\">". elgg_echo("notifications:delete:link") . "</a>";

    // echo "</span>";

     

    echo ("<a href=\"$url/pg/profile/$action_user->username\">".elgg_view("profile/icon",array('entity' => $action_user, 'size' => 'small')) . $action_user->name . "</a> ". $desc . "<span class=\"time\">" .$friendlytime ."</span>");

    echo "</div>";

     

    ?>

  • "help" delete.php for elgg_notify plugin