Jump to content

service-voice

Newbie
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

10 Good

About service-voice

  • Rank
    Newbie
  1. service-voice

    Whmcs menu rebuild

    Someone has ideas how to create a menu for a guest, clear the built menu and create it again for an authorized user? I need this for the menu editor.
  2. service-voice

    Whmcs menu rebuild

    Hi, I'm having a problem with rebuilding the menu in whmcs. On version 7.4.1, this code works for me: <?php /** * Created by PhpStorm. * User: Artem * Date: 24.12.2017 * Time: 21:46 */ namespace AnonymousPayment\Controller; use \Menu; use AnonymousPayment\Controller\WHMCSClientController; class WHMCSMenuItemController { /** * @var \Knp\Menu\MenuItem; */ private static $PrimaryNavBar; public static function GetPrimaryNavBarStructure( $UserLogin ) { if ( $UserLogin ) { $_SESSION['uid'] = WHMCSClientController::GetFirstUserID(); } else { unset( $_SESSION['uid'] ); } self::$PrimaryNavBar = Menu::primaryNavbar(); run_hook( 'ClientAreaPrimaryNavbar', self::$PrimaryNavBar ); self::$PrimaryNavBar = self::$PrimaryNavBar->sort( self::$PrimaryNavBar ); foreach ( self::$PrimaryNavBar->getChildren() as $key => $val ) { $Structure[ $key ]['translate'] = $val->getLabel() . ' '; if ( $val->hasChildren() ) { foreach ( $val->getChildren() as $key2 => $val2 ) { $Structure[ $key ]['SumItem'][ $key2 ]['translate'] = $val2->getLabel(); } } } Menu::swap(); return $Structure; } } However, in the whmcs version 7.6.0 Beta1 this code does not work, the error occurs in "Menu :: swap ()", now it is required that I pass there the argument, I used this call to clear the built menu. I tried to pass this function as a parameter "Menu :: self ()", but this did not give the desired result. I tried to use "Menu :: clearResolvedInstances ()" however this also did not help.
×

Important Information

By using this site, you agree to our Terms of Use & Guidelines