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?
  • please, read my aboving reply...

    U need call $sidebar = elgg_view("videochat/sidebar");

    and then add it as array

    $body = elgg_view_layout('two_column_left_sidebar', array(
        'content' => $content,
        'title' => $title,
        'sidebar' => $sidebar,
        ));

     

  • I do all how you write , but I don't see  items

  • 1 - What Tokbox method in your videochat settings?

    2 - Which on pages you want to see sidebar?

  •  Add

    $sidebar= elgg_view("videochat/sidebar");

    and

    $body = elgg_view_layout('two_column_left_sidebar', array(
        'content' => $content,
        'title' => $title,
        'sidebar' => $sidebar,
        ));

    In all files in this folder

    mod\videochat\pages\

  • in this dir I have 3 files create.php

    this code

    <?php  
            /**
             * @package OpenTok VideoChat
             * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
             * @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca]
             * @link http://grc.ucalgary.ca/
         * @author Jeroen Dalsem, ColdTrick IT Solutions [jdalsem@coldtrick.com]
             * @link http://coldtrick.com/
         * @remark Please see CREDITS
             */
     
        // title
        $title_text = elgg_echo("videochat:forms:create");
        $content = elgg_view_title($title_text);
        $content = elgg_view("videochat/forms/create");
            $sidebar = elgg_view("videochat/sidebar");
        //select the correct canvas area
        $body = elgg_view_layout('two_column_left_sidebar', array(
        'content' => $content,
        'title' => $title,
        'sidebar' => $sidebar,));
            
        // Display page
        echo elgg_view_page($title_text,$body);
        
    ?>

    2 files index.php

    <?php  
            /**
             * @package OpenTok VideoChat
             * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
             * @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca]
             * @link http://grc.ucalgary.ca/
         * @author Jeroen Dalsem, ColdTrick IT Solutions [jdalsem@coldtrick.com]
             * @link http://coldtrick.com/
         * @remark Please see CREDITS
             */
     
        global $CONFIG;
     
        // title
        $title_text = elgg_echo("videochat:index:title");
        $content = elgg_view_title($title_text);
        $sidebar= elgg_view("videochat/sidebar");
        
        
        if(elgg_get_plugin_setting("tokbox_method", "videochat") != "embed"){
        
            $rooms_options = array(
                    "type" => "object",
                    "subtype" => "videochat_room",
                    "limit" => false
                );
                
            $rooms = elgg_list_entities($rooms_options);
            if(empty($rooms)){
                $body = elgg_echo("videochat:rooms:no_rooms");
                if(isloggedin()){
                    $body .= " " . sprintf(elgg_echo("videochat:rooms:start_one"), "<a href='" . $CONFIG->wwwroot ."pg/videochat/create'>", "</a>");
                } else {
                    $body .= " " . elgg_echo("videochat:rooms:login_to_start_one");
                }
                
                $rooms = elgg_view("page_elements/contentwrapper", array("body" => $body));
            }
            
            $content .= $rooms;
            
            //select the correct canvas area
            $body = elgg_view_layout('two_column_left_sidebar', array(
        'content' => $content,
        'title' => $title,
        'sidebar' => $sidebar,
    ));
     
        } else {
            $title = elgg_view_title($title_text);
     
            $embed_url = get_plugin_setting("tokbox_embed_url", "videochat");
            $embed= '<iframe id="basicEmbed" src="' . $embed_url . '" width="350" height="265" style="border:none"></iframe>';
     
     
            $body = elgg_view_layout('two_column_left_sidebar', array(
        'content' => $content,
        'title' => $title,
        'sidebar' => $sidebar,
    ));
        }
        
        // Display page
        echo elgg_view_page($title_text,$body);
    ?>

    3 file join.php

    <?php
            /**
             * @package OpenTok VideoChat
             * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
             * @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca]
             * @link http://grc.ucalgary.ca/
         * @author Jeroen Dalsem, ColdTrick IT Solutions [jdalsem@coldtrick.com]
             * @link http://coldtrick.com/
         * @remark Please see CREDITS
             */
     
        global $CONFIG;
        require_once($CONFIG->pluginspath . "videochat/vendors/opentok-php-sdk.2011-08-26/OpenTokSDK.php");
        
        $group_guid = get_input("group_guid");
        $popout = get_input("popout", false);
        $group_layout = false;
        
        if(!empty($group_guid) && ($group = get_entity($group_guid))){
            if($group instanceof ElggGroup){
                // chat initiated from a group
                if($room_id = $group->videochat_room_id){
                    // room previously created
                    $room = get_entity($room_id);
                    $group_layout = true;
                }
                
                if(!$room){
                    // no room was previously created, or something else went wrong, create a new persistent group chatroom
                    
                    try {
     
                $api = new OpenTokSDK(API_Config::API_KEY,API_Config::API_SECRET);
    try {
        $session_id= $api->create_session('127.0.0.1')->getSessionId();
     
     
    }catch(OpenTokException $e) {
        print $e->getMessage();
    }
                        if(!empty($session_id)){
                        
                            $room =  new ElggObject();
                            $room->subtype = "videochat_room";
                            $room->owner_guid = $group->getGUID();
                            $room->title = sprintf(elgg_echo("videochat:room:group"), $group->name);
                            $room->access_id = $group->group_acl;        
                            
                            if($room->save()){
                                $room->session_id = $session_id;
                                $room->persistent = true;
                                $group->videochat_room_id = $room->getGUID();
                                $group_layout = true;
                            } else {
                                register_error(elgg_echo("videochat:actions:create:error_save"));
                                $forward = REFERER;
                            }    
                        } else {
                            register_error(elgg_echo("videochat:actions:create:no_call_id"));
                            $forward = REFERER;
                        }
                        
                    } catch(Exception $e) {
                        
                        $error = $e->getMessage();
                        register_error($error);
                        
                        $forward = REFERER;
                    }
                }
            }
        }
        
        if(empty($room)){
            // no group so try normal join
            $room = get_entity(get_input("guid"));
            
            if($room){
                // check if this is a group room
                $videochat_options = array(
                    "type" => "group",
                    "limit" => 1,
                    "metadata_names" => "videochat_room_id",
                    "metadata_values" => $room->getGUID()
                );
     
                if($groups = elgg_get_entities_from_metadata($videochat_options)){
                    $group = $groups[0];
                    $group_layout = true;
                }
            }
        }
        
        if($group_layout){
            set_context("groups");
            set_page_owner($group->guid);
        }
     
        if($room instanceof ElggObject && $room->getSubtype() == "videochat_room"){
            
            if(!empty($room->session_id)){
            } else {
                $error = elgg_echo("videochat:join:no_callid");
            }
        } else {
            $error = elgg_echo("videochat:join:no_room");        
        }  
        
        if(!empty($error)){
            register_error($error);
            forward($CONFIG->wwwroot . "pg/videochat");
        } else {
             
            // title
            $title_text = elgg_echo("videochat:index:title") . ": " . $room->title;
            $title = elgg_view_title($title_text);
            $body = elgg_view("tokbox/chat", array("callUrl" => 'dummy', "popout" => $popout, "group_layout" => $group_layout, "room" => $room));
     
            //select the correct canvas area
            if($popout){
                echo "<html><head><title>" . $title_text . "</title><link href=\"" . $CONFIG->wwwroot . "/mod/videochat/views/default/videochat/css.php\" rel=\"stylesheet\"><script type=\"text/javascript\" src=\"" . $CONFIG->wwwroot . "vendors/jquery/jquery-1.3.2.min.js\"></script></head><body>" . $body . "</body></html>";
            } else {
                if($group_layout){
                    
                    $page_data = elgg_view_layout("two_column_left_sidebar", "", $title . $body);    
                } else {
                    $page_data = elgg_view_layout("one_column", $title . $body);
                }
                
                // Display page
                page_draw($title_text,$page_data,$sidebar);
            }
        }    
    ?>

    when I must past you code. please help

  • Just in create.php for this URL your-cool-site.com/videochat/create

    and index.php for this URL your-cool-site.com/videochat/

    Both URL should display the sidebar (on the right side)

  • I don't understand. this plugin may load in this page >>>>>>

  • 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"));

    http://reference.elgg.org is your friend...

    'page' (menu name) is a necessary parameter. It's not a menu but a menu item that should be created.

    "pg": pagehandler function might need some updates before the link will work ("pg" is Elgg 1.7 and older - Elgg 1.8 has no "pg" in urls anymore).

  • This plugin work on Elgg 1.7 very well.