River Core

in the core river code, there is a menu created for items in the river activity, delete, comments, likes....

$menu = elgg_view_menu('river', array(
    'item' => $item,
    'sort_by' => 'priority',
    'class' => 'elgg-menu-hz',
));

where is this menu actually created, have been searching for and hour or so and found lots of other stuff that i have been looking for but not this menu, a guess or any ideas??

  • ok, so i have figured out how to add a delete button to river items in hypealive, but only for the admin.......need to figure out where this menu is created or gets its instructions to enable it for users and then i will be really happy, help anybody?

  • my last major problem before i take my site live, surely somebody has a delete option in the river activity for users?  maybe?????

  • I found it here on line14

    views/default/river/elements/body.php

  • sorry steve, i should have made myself more clear.  I know thats where the view comes from, i am trying to figure out where the menu itself is created or gets its instructions.  Usually, i think, like an entity menu, it is setup in the start.php file of a plugin.  I have found the view menu as you said, found the delete function, found the action file, but cant find where the menu is created or gets it instructions, such as admin only, users, the link, the icon, anything........

     

  • Look at this page
    http://reference.elgg.org/views_8php.html

    do a find for  elgg_view_menu()

    Maybe it will give you insight

  • @steve, found it, thanks a lot for your help

     

  • one last thing now the code is currently:

            if (elgg_is_admin_logged_in()) {
                $options = array(
                    'name' => 'delete',
                    'href' => "action/river/delete?id=$item->id",
                    'text' => elgg_view_icon('delete'),
                    'title' => elgg_echo('delete'),
                    'confirm' => elgg_echo('deleteconfirm'),
                    'is_action' => true,
                    'priority' => 200,
                );
                $return[] = ElggMenuItem::factory($options);
            }

    now if i remove the admin, it would allow everybody to delete anything they wanted even if it wasnt theirs.  since i am still trying to learn this coding thing and have only accomplished updating and moding plugins, unsure of what i need to do here.  Isnt there a way to make the owner match the object through an owner id or something?  to allow only the person who created it to delete it?

     

  • sweet thanks again Steve, not only did i find what i was looking for, but it worked out better than i even intended.  Not only can my users delete what they created, they can delete river items that pop of that are related to them.......example if UserA posts on userB's message board and it creates a river item, UserB can delete the river item even though he isnt the owner.  I hope this will cut down a lot on the number of items reported that the user could not simply delete before but now can!  Again thanks alot steve

  • Hi Costakisc,

    Would you please let us know how you did that, I'm really interesting in and honestly, I'm not expert in dev so would be difficult for me to find out how to acheive that !

    Regards,