People From The Neighborhood v1.2

Release Notes

Developed in (and for) Elgg 1.7.6 environment.

I didn't test it properly, so I'll appreciate any comment about your experience using it.

Also, I want you to help me fill the ToDo list with good ideas ;-)

Features:

- Dashboard widget!

Fixes:

- It did suggest some befriended users.

ToDo:

- Profile Widget ?

- Hide person support

  • @Thuvalpakshi I didn't try it with elgg 1.7.8, I'll when I can...

    In the mean time, someone else is having the same issue?

    Cheers!

  • @ emdagon, your pluggin is really good. this was working beautifully in 1.7.7. after i upgraded to 1.7.8 it is throwing an error which i mentioned above. please do check.

    Thank you very much

  • im using your plugin and all is working great except ive put the widget on my custom dashboard and the widget displays about 20 users "i may know" and that number keeps going up.  any ideas?

    <?php
    ?>
    <div class="sidebarBox">
    <div class="membersWrapper"><br />
    <h3>People You May Know</h3>
    <?php
    gatekeeper();
    $widget = $vars['entity'];
    $friends = $widget->look_in_friends == 'no' ? 0 : 0;
    $groups = $widget->look_in_groups == 'no' ? 0 : 0;
    $num_display = $widget->num_display != null ? $widget->num_display : 0;
    $people = people_from_the_neighborhood_get_people(get_loggedin_userid(), 1, $groups);
    echo elgg_view('people_from_the_neighborhood/people', array('people' => $people)); ?>
    <div class="clearfloat"></div>
    <div class="widget_more_wrapper"><a href="<?php echo $vars['url']; ?>pg/pftn"><?php echo elgg_echo('pftn:see:more'); ?></a></div>
    </div>
    </div>

  • @emdagon hi, the problem that i showed before is happening when trying to fetch members of group, if you call this page Friends of my friends (pg/pftn/friends/) there is no problem. but if you try to call Members of my groups (/pg/pftn/groups/) then create the database exception error

  • problem solved by commenting out the  line 114     problem was with sorting.

    'order_by' => 'time_created DESC'

     

    thank you very much for creating such a nice pluggin.

  • Limitation doesn t work. I set it to 5 but i have a loooooooong list... this must be a bug.

  • Any word on the setting limitations fix?

  • i would like to know it also, it is a bug...

  • I really sorry, but I'm quite busy these days.

    I promise I'll make the time for fix that bug and some improvements.

    Cheers!

  • Added a link under each person to "Add as Friend". 

    @emdagon: feel free to include this is you like. In pftn/views/default/people_from_the_neighbourhood/people.php

    Add the following code in the the following places:

    Line 13:

    $ts = time();

    $token = generate_action_token($ts);

    Lines 24,31,38,45:

    $info .= "<span>" . "<a href='{$vars['url']}action/friends/add?friend={$person['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts'>" . elgg_echo('pftn:suggest:add') . "</a>" . "</span>";

    Then stick the following in the language file:
    'pftn:suggest:add' => "Add as Friend",
    Enjoy!
  • @Trajan nice addition! I'll add it in the next release =)

    Thanks a lot!

  • @ trajan

    or

    @ emdagon

    Can you just paste all of the people.php file (with the add as friend modifications already made) because I cant seem to follow your instructions (my fault).

    I can do the language file add.  Thanks

  • For those who can't quite get the above to work. Here is my entire people.php

    <?php

    /**

    * people_from_the_neighborhood

    *

    * @author emdagon

    * @link http://community.elgg.org/pg/profile/emdagon

    * @copyright (c) Condiminds 2011

    * @link http://www.condiminds.com/

    * @license GNU General Public License (GPL) version 2

    */

     

    $people = $vars['people'];

    $ts = time();

    $token = generate_action_token($ts);

    if (is_array($people) && sizeof($people) > 0) {

     

    foreach ($people as $person) {

    $info = '<p><b><a href="' . $person['entity']->getUrl() . '">' . $person['entity']->name . '</a></b></p>';

     

    $mutuals = count($person['mutuals']);

    if ($mutuals == 1) {

    $friend = $person['mutuals'][0];

    $info .= '<p>' . sprintf(elgg_echo('pftn:is:friend:of'), '<a href="' . $friend->getURL() . '">' . $friend->name . '</a>') . '</p>';

    $info .= "<span>" . "<a href='{$vars['url']}action/friends/add?friend={$person['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts'>" . elgg_echo('pftn:suggest:add') . "</a>" . "</span>";

    } else if ($mutuals > 1) {

    $friends = array();

    foreach ($person['mutuals'] as $friend){

    $friends[] = '<a href="' . $friend->getURL() . '">' . $friend->name . '</a>';

    }

    $info .= '<p>' . sprintf(elgg_echo('pftn:mutual:friends'), $mutuals, implode(', ', $friends)) . '</p>';

    $info .= "<span>" . "<a href='{$vars['url']}action/friends/add?friend={$person['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts'>" . elgg_echo('pftn:suggest:add') . "</a>" . "</span>";

    }

     

    $shared_groups = count($person['groups']);

    if ($shared_groups == 1) {

    $group = $person['groups'][0];

    $info .= '<p>' . sprintf(elgg_echo('pftn:is:member:of'), '<a href="' . $group->getURL() . '">' . $group->name . '</a>') . '</p>';

    $info .= "<span>" . "<a href='{$vars['url']}action/friends/add?friend={$person['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts'>" . elgg_echo('pftn:suggest:add') . "</a>" . "</span>";

    } else if ($shared_groups > 1) {

    $groups = array();

    foreach ($person['groups'] as $group){

    $groups[] = '<a href="' . $group->getURL() . '">' . $group->name . '</a>';

    }

    $info .= '<p>' . sprintf(elgg_echo('pftn:shared:groups'), $shared_groups, implode(', ', $groups)) . '</p>';

    $info .= "<span>" . "<a href='{$vars['url']}action/friends/add?friend={$person['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts'>" . elgg_echo('pftn:suggest:add') . "</a>" . "</span>";

     

    }

     

    echo elgg_view('entities/entity_listing', array(

    'icon' => elgg_view('profile/icon', array('entity' => $person['entity'])),

    'info' => $info

    ));

     

    }

    } else {

    echo elgg_echo('pftn:people:not:found');

    }

  • how could you add a picture net to "Add as Friend"

    like         image Add as Friend

  • $info .= "<span>" . "<a href='{$vars['url']}action/friends/add?friend={$person['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts'><img src='{$vars['url']}mod/plugin/graphics/file.png'>" . elgg_echo('pftn:suggest:add') . "</a>" . "</span>";

  • @ Trajan
    You are good! Thank you for all your help.

  • @ Trajan THANK YOU. Do you know how to solve widget people limitaton bug described before in this topic?

  • @martinez: I've not found the solution to that either. I am having the same issue and will try to do find the fix asap.

  • i can t use the plugin, because i have almost 30 people on my list and it slows down my page like hell.

    did you find solution? sorry, i m beginer with php...

  • any solution to the widget people limitaton bug???

  • Smith

    It's not possibile to use this plugin, because i have almost 100 people on my list. It is slow!

    Any suggestion?

     

     

emdagon

+8 years since I have been here! xD

Stats

  • Category: Misc
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 3317
  • Recommendations: 19

Other Projects

View emdagon's plugins