Error "add_submenu_item was deprecated by elgg_register_menu_item"

When I change in this string "add_submenu_item(elgg_echo('videochat:menu:rooms'), $CONFIG->wwwroot."pg/videochat");" Because I look error in site

Deprecated in 1.8: add_submenu_item was deprecated by elgg_register_menu_item
Called from [#10] /var/www/sitename.ru/www/vkte/vk/mod/videochat/start.php:33
add_submenu_item change on this function
elgg_register_menu_item . I don't look item in menu.
What you think?
  • Of course it works well on Elgg 1.7 as add_submenu_item is a Elgg 1.7 functions. If you want to use it in Elgg 1.8, don't want to see the warning messages and want to make sure it still works in future Elgg versions, you need to update. elgg_register_menu_item() is one thing to be used now. The views is something else to update for example. You need to update the plugin file by file, check line by line if necessary. You can't expect the plugin to work if some things are not yet fixed as they will break the whole functionality. Sometimes you might need to fix only small things for the whole plugin to work perfectly. But it still takes time to review the code. And it takes time to learn the things that need to be fixed for older plugins to work in Elgg 1.8.

    http://reference.elgg.org is one thing that's quite useful. In connection with the deprecated warnings you will know what to change. Other things like the basic structure (filenames, directory tree) that might need to be changed is not explained on the reference site. Best things is to look at working Elgg 1.8 plugins to learn how it works.

    It won't help you in the long run to ask about every little detail here at the site. You need to expect that especially the first few plugins will take time to upgrade. Don't think about hours. It's rather days (for a simple, small plugin) and rather weeks for a more complex plugin.

  •        Good day! Why adapt this code for elgg 1.8     
    add_submenu_item(elgg_echo('videochat:menu:rooms'), $CONFIG->wwwroot."pg/videochat");
    //elgg_register_menu_item('page', array('name' => elgg_echo('videochat:menu:rooms'), 'href' => $CONFIG->wwwroot."videochat"));
                    if(elgg_is_logged_in()){
                        add_submenu_item(elgg_echo('videochat:menu:create'), $CONFIG->wwwroot."pg/videochat/create");
                    }            
                } else {
                    if($user =  elgg_get_logged_in_user_entity()){
                        // Get the page owner entity
                        $page_owner = elgg_get_page_owner_entity();
                
                        // Submenu items for all group pages
                        if ($page_owner instanceof ElggGroup && $context == 'groups'){
                            if($page_owner->isMember($user)){
                                add_submenu_item(elgg_echo("videochat:menu:group"), $CONFIG->wwwroot . "pg/videochat/group/" . $page_owner->getGUID());

  • How says iionly

    If you want to use it in Elgg 1.8, don't want to see the warning messages and want to make sure it still works in future Elgg versions, you need to update

     

    If your plugin for Elgg 1.7 works now for Elgg 1.8 then don't need to update it. But ...-> read iionly's advices

  • Whis code work propetly for ad_menu_item.

    $item = new ElggMenuItem('videochat', elgg_echo('videochat:index:title'), 'videochat');
    elgg_register_menu_item('site', $item);

    You know code for ad_submenu_item?

  • No difference.

     

    Some example

    Elgg 1.7

    add_submenu_item(elgg_echo('videochat:menu:create'), $CONFIG->wwwroot."pg/videochat/create");

     

    Elgg 1.8

    elgg_register_menu_item('page', array(
                    'name' => 'videochat',
                    'text' => elgg_echo('videochat:menu:create'),
                    'href' => "/videochat/create",
                ));

  • This work propetly . You very good specialist.