GOT Posted November 24, 2018 Share Posted November 24, 2018 I am not a developer and looking at tutorials about modifying menu structure are beyond me, plus I have a non-fixed item to add. Basically, many (not all) clients of mine gets a custom coded url that integrates a key to facilitate one click log in, so I can't hard-code the url for every client. What I am thinking is a custom client field that is their URL, and then a menu item that pulls that link from their client data and displays it in the side menu. But only if that data exists, if that client field is blank then then menu item would not appear at all. Is there an existing module for this kind of thing? Is there some way to do this already built in to whmcs? Otherwise, is there someone out there that can code me a module for this at a reasonable cost? I'm guessing this would be reasonably simple for someone familiar with customizing whmcs. 0 Quote Link to comment Share on other sites More sharing options...
GOT Posted November 24, 2018 Author Share Posted November 24, 2018 Thanks for the quick reply. The URL looks like this https://got-monitor.com/group.htm?id=0&username=XXXXXXXX&password=XXXXXXX That's our domain, but its a different domain than our WHMCS is on. URL is always the same save for the user/password. This URL is for our clients that have managed services through us which is most of them but not all of them. We would not want the url or menu item to show at all if they do not have a log in to the monitoring system to begin with. We'd want a solution that is impervious to getting overwritten on whmcs updates. An even better solution might be to store the username and password for their log in and just pull that data when crafting the url for the menu item. If better to talk about the project in private, you can reach me at greenot on skype. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 25, 2018 Share Posted November 25, 2018 the following action hook will check if client is logged in, and if the configured custom field has a value, then add new menu item to primary navbar as an example. create new php file (eg. Navbar_MonitorLoginLink.php) inside "/includes/hooks/" directory, copy and edit the required lines: <?php /** * @author SENTQ */ use WHMCS\Database\Capsule; # We are working on Primary Navbar add_hook("ClientAreaPrimaryNavbar", 1, function($primaryNavbar){ # Client Custom Field Name $customFieldName = "Username"; // **Change this value # Get Client $client = Menu::context("client"); # Not Logged In! if ($client === null){ return; } # Get Custom Field Value $getURL = Capsule::table("tblcustomfieldsvalues") ->join("tblcustomfields", "tblcustomfields.id", "=", "tblcustomfieldsvalues.fieldid") ->where("tblcustomfieldsvalues.relid", "=", $client->id) ->where("tblcustomfields.type", "=", "client") ->where("tblcustomfields.fieldname", "=", $customFieldName) ->select(["tblcustomfieldsvalues.value"]) ->first(); # Custom Field Value is Empty! if (!$getURL->value){ return; } # Add New Menu Item To Primary Navbar -> Home $newLoginLink = $primaryNavbar->addChild('Home', array( "name" => "New_login_link", "label" => "New Login Link", // **Change this line as well "uri" => $getURL->value, "order" => 100 )); }); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.