brian! Posted December 2, 2018 Share Posted December 2, 2018 in response to the thread below, please find attached two hooks to generate Homepage Panels to output a clients email history (with clickable links) - don't use both, just choose one! 🙂 The "original" version, that I quickly wrote as a demo for the above thread, links each row to open that email in a new tab/window... The updated "popup" version includes a clickable "button" that opens the email in a popup window (as per the Email History page accessible from the secondary navbar menu)... both panels use Language Translations to display the phrases "Email History", "View All" and "View" in the client's language. the date output uses the Global Date Format (as specified in your general settings -> localisation) - you could easily make it use the Client Date Format, but because we only have limited space for date and subject, I thought it easier to use the shorter global format. currently, the hook obtains ALL of your clients email history - if you want to limit that to a certain amount, e.g 100, then you would add a limit to the query... $clientemails = Capsule::table('tblemails')->where('userid', $client->id)->select('id','subject','date')->orderBy('date','desc')->limit(100)->get(); with additional coding, and probably some new Language Overrides, you should be able to identify each email type (based on the subject), and color the "button" links accordingly... i'm not going to include that version here - not least because it would require a lot of coding (which I haven't done!) to thoroughly cover all email templates and languages , but it would be achievable given the required effort. 4 Quote Link to comment Share on other sites More sharing options...
cybershubham Posted December 2, 2018 Share Posted December 2, 2018 Thanks a lot Brian! 😊 0 Quote Link to comment Share on other sites More sharing options...
cdeese8 Posted December 6, 2018 Share Posted December 6, 2018 Well look at what we have here.... another top quality share by none other than the legendary brian! thanks dude! always nice to be able to learn from your code... thank you very much. :) 0 Quote Link to comment Share on other sites More sharing options...
cdeese8 Posted December 9, 2018 Share Posted December 9, 2018 (edited) Hey @brian! - if it's not too much trouble, could you please share how I would update / tweak your above code to wrap the email history date in an HTML <span class=""XYZ"> tag? Is something like that easily doable without much effort? https://forums.whmcs.com/showthread.php?127034-home-page-panel-add-array-title-and-target-to-href https://developers.whmcs.com/hooks/hook-index/ http://docs.whmcs.com/Working_With_Client_Area_Home_Page_Panels https://developers.whmcs.com/hooks-reference/client-area-interface/#clientareahomepagepanels Could we take some of the code from clientareahome.tpl and recycle it into the "extra" part of the php snippet? {if $item->getChildrenAttribute('class')} {if $childItem->getClass()} {$childItem->getClass()}{/if} Edited December 9, 2018 by cdeese8 forgot to add resource links 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 10, 2018 Author Share Posted December 10, 2018 i'm supposed to be on holiday! 🎄 12 hours ago, cdeese8 said: Hey @brian! - if it's not too much trouble, could you please share how I would update / tweak your above code to wrap the email history date in an HTML <span class=""XYZ"> tag? Is something like that easily doable without much effort? no effort... using the original hook version... ->addChild($key)->setLabel('span class="xyz">'.fromMySQLDate($child->date,true,false).'</span> - '.$child->subject)->setUri('viewemail.php?id='.$child->id)->setAttribute('target','_blank'); 12 hours ago, cdeese8 said: Could we take some of the code from clientareahome.tpl and recycle it into the "extra" part of the php snippet? not really - the code in the template is just a way of displaying the array that you're creating in the hook - you could give a child item a css class by using setClass in the hook, but it would apply to the entire chiild, not a particular part of it, e.g the date. 1 Quote Link to comment Share on other sites More sharing options...
cdeese8 Posted January 2, 2019 Share Posted January 2, 2019 tyvm for the detailed, and helpful hooks brian! :) 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.