Jump to content
brian!

Email History Homepage Panel

Recommended Posts

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...

rUpNLZv.png

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)...

cYnd4RJ.png

  • 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...

C1C3bKG.png

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.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

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.

:)

Share this post


Link to post
Share on other sites

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?

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 by cdeese8
forgot to add resource links

Share this post


Link to post
Share on other sites

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.

santa-reindeer-dancing-1.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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