plugin settings error: Deprecated in 1.8: admin plugins should route through 'admin'

Deprecated in 1.8: admin plugins should route through 'admin'. Called from [#7] D:\xampp\htdocs\elgg\engine\lib\views.php:503

what‘s the reason of this error, and what shall i do?
  • Which version of elgg are you using? Did you do any modifications to the core files? Is it a clean install or an update? Any third party plugin?

    Rodolfo Hernandez

    Arvixe/Elgg Community Liaison

  • I came across this deprecated message once, too. Unfortuntunately, I can't remember right now which plugin gave this message. What you might need to do is to move the view for the plugin settings of this plugin to mod/this_plugin/views/default/admin/<view_name>.php. And you might also need to adjust the page handler in start.php to point to the new view - or you might not even need to include this view in the page handler at all but create a menu item in the admin section using the elgg_register_admin_menu_item() function.

  • This is one of the more complicated deprecation notices to fix.  It's caused by the changes in 1.8 adding a separate theme for the admin pages.  Admin pages now need to be created by registering special views.

    The good news is that it shouldn't affect the plugin, it should still work.  Just let the original author know.

  • To be more precise: by plugin settings I don't mean the "normal" plugin settings that should be kept in /views/default/plugins/plugin_name/settings.php but some additional settings page the plugin is trying to create in a different section.

  • 'some plugin' is *not using 
    canvas/layouts/<layout_name>
    or
    page/layouts/<layout_name>
    and is in context = 'admin'

    the core only says 'helpfully' :-
    // backward compatability support for plugins that are not using the new approach
    // of routing through admin. See reportedcontent plugin for a simple example.

    ;-)

     

  • it's the setting of this plugin: "Elgg Social Commerce Plugin" .

    I thinks it is because there are many differences between elgg1.8 and 1.78, such as view-system structure , plugin setting  handle ,and so on.

    But where can i find those changes?  Is there any document about those changes?

  • @matt,yes it works,but not display correctly.  it is different from other plugins' setting in elgg1.8.

    how to make it works in elgg1.8?

  • @iionly , thanks! 

    I do move the setting file into the correct directory: mod/sc/views/default/admin/, how to how to piont to it in the page_handler!

    the original code like this :

    function sc_page_handler($page) {
             switch ($page[1]) {
                 case "settings":
                    //@include(dirname(__FILE__) . "/socialcommerce_settings.php");
                    @include(dirname(__FILE__) . "/socialcommerce_settings.php");
                    break;
            }}

     

    i think the original 'socialcommerce_settings.php' is a web page,,but once in /views/default/admin/,it is a view. so i do not know what to do?

  • It's not that easy... at a brief look I can only say this plugin is highly complex. It also seems there's a LOT of work to do to get this working properly in Elgg 1.8. The socialcommerce_settings.php is indeed a page. The page is built up using other views (for example modules/general_settings.php). If I would be working on fixing this plugin I would most likely completely re-model the whole page / views structure of this plugin to be more Elgg-standardish, for example move/modify socialcommerce_settings.php to views/default/admin and make it a view using Elgg 1.8 layouts. This views can be included in the admin section as a menu option using elgg_register_admin_menu_item() in start.php. You also need to modify the pagehandler / pagesetup functions accordingly.

    If this is the first plugin you are trying to fix I would suggest to you to either take yourself a lot of time to study the code and compare it a lot to other working plugins for Elgg 1.8 to better understand what you need to change - also constantly referring to http://reference.elgg.org. Or you might better start a bit smaller by working on some simplier plugins first - if the plugin is less complex you will have less problems to solve at the same time and you will be able to fix them one after the other. With the social_commerce plugin you might have to solve many problems first before you even get it running and can test if you solved them successfully.