Jump to content

Email History Homepage Panel


brian!

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.

Link to comment
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
Link to comment
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

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated