Peter Butler Posted February 19, 2019 Share Posted February 19, 2019 I can't find any topic regarding this but here I go... I have added a 'Client Info' section in the sidebar, when viewing the support ticket. Screenshot - I edited in /admin/templates/blend/sidebar.tpl and added 2 new fields 'Company' and 'Website' Screenshot - However, I can't get to parse the data of the Company and Website URL field from the client profile. Can you please help how to parse the data? Note: I'm not a coder. 🙂 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 19, 2019 Share Posted February 19, 2019 Hi Peter, 15 hours ago, Peter Butler said: However, I can't get to parse the data of the Company and Website URL field from the client profile. because they don't exist in the template - you would need to query the database to create them using a hook... e.g to get the company name of the client.. <?php # Admin Area Sidebar Get Client's Company Name Hook # Written by brian! use Illuminate\Database\Capsule\Manager as Capsule; function admin_sidebar_company_name_hook($vars) { if ($vars['pagetemplate'] == 'viewticket') { $userid = $vars['userid']; $results = Capsule::table('tblclients')->where('id',$userid)->value('companyname'); return array("companyName" => $results); } } add_hook("AdminAreaPage", 1, "admin_sidebar_company_name_hook"); ?> website URL would be a different matter as I assume for you that's a client custom field ? 0 Quote Link to comment Share on other sites More sharing options...
Peter Butler Posted February 22, 2019 Author Share Posted February 22, 2019 Hi brian, Thanks so much! I was able to display the company name in the sidebar now - I tried editing the code to display the website url but I had no luck. Here is the edited code: Quote <?php # Admin Area Sidebar Get Client's Company Name Hook # Written by brian! use Illuminate\Database\Capsule\Manager as Capsule; function admin_sidebar_website_url_hook($vars) { if ($vars['pagetemplate'] == 'viewticket') { $userid = $vars['userid']; $results = Capsule::table('tblclients')->where('id',$userid)->value('websiteUrl1'); return array("websiteUrl1" => $results); } } add_hook("AdminAreaPage", 1, "admin_sidebar_website_url_hook"); ?> I get the 'websiteUrl1' name from the custom field and patterned after companyName. So, yeah I guess it's not correct 😄 Only the website url is missing. Thanks for all you help Brian. Really appreciate it. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Md Rasel Khan Posted March 17, 2021 Share Posted March 17, 2021 (edited) @brian! Could you please tell me how to move the additional tab to left sidebar using hook? https://prnt.sc/10nxsvm Edited March 17, 2021 by Md Rasel Khan 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 17, 2021 Share Posted March 17, 2021 4 hours ago, Md Rasel Khan said: Could you please tell me how to move the additional tab to left sidebar using hook? https://prnt.sc/10nxsvm you couldn't move it in the sense of taking the code from one and embedding it in the other - what you would have to do is to create a new sidebar, query the db for the appropriate customfield content and then hide/remove the additional info box from the template. also, you would have to work out how to handle outputting each type of custom field - e.g., with links, you probably couldn't visually show the URLs as they'd be too long for a sidebar - so you could add a link to them.... and whether you just want one specific field or if you need to show them all. 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.