jawanet Posted September 30, 2016 Share Posted September 30, 2016 How to get email admin and client on viewticket.tpl template I use <img src="https://www.gravatar.com/avatar/{$reply.email}?s=30&d=mm" class="menu-avatar" alt=""> not showing photo email gravatar, but showing default photo from gravatar. Tanks very much for help. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 30, 2016 Share Posted September 30, 2016 add a {debug} to the end of the viewticket.tpl template - when you refresh the page, you should get a popup window of Smarty arrays/variables.... is $reply.email empty ? 0 Quote Link to comment Share on other sites More sharing options...
jawanet Posted September 30, 2016 Author Share Posted September 30, 2016 (edited) $replay.email only have email client, what function to get email admin? Or you can provide code to work get avatar from gravatar on viewticket.tpl sir? Edited September 30, 2016 by jawanet 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 30, 2016 Share Posted September 30, 2016 if it's not there, you'll need to use an action hook to query the database to get the admin email. 0 Quote Link to comment Share on other sites More sharing options...
jawanet Posted September 30, 2016 Author Share Posted September 30, 2016 Okay, can you write here what hook to get admin email on viewticket ? Tanks very much for help sir. 0 Quote Link to comment Share on other sites More sharing options...
jawanet Posted September 30, 2016 Author Share Posted September 30, 2016 Can you fix this script? and add to hook $grav_size = '40'; $replies = $this->_tpl_vars['descreplies']; $data = select_query('tbladmins', 'firstname, lastname, email', array()); $admins = array(); while ($admin = mysql_fetch_assoc($data)) { $adminname = $admin['firstname'].' '.$admin['lastname']; $d = array_search($adminname, $adminreplies); $admins[] = array('name' => $adminname, 'email' => $admin['email']); } foreach ($replies as $key => $val) { if ($val['admin'] !== false) { $d = multidimensional_search($admins, array('name'=>$val['name'])); if (is_int($d)) { $hash = md5(strtolower(trim($admins[$d]['email']))); $replies[$key]['gravatar'] = 'https://secure.gravatar.com/avatar/'.$hash.'?'.$grav_size; } } } $this->_tpl_vars['descreplies'] = $replies; function multidimensional_search($parents, $searched) { if (empty($searched) || empty($parents)) { return false; } foreach ($parents as $key => $value) { $exists = true; foreach ($searched as $skey => $svalue) { $exists = ($exists && IsSet($parents[$key][$skey]) && $parents[$key][$skey] == $svalue); } if($exists){ return $key; } } return false; } 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 30, 2016 Share Posted September 30, 2016 how many staff members do you have replying to tickets? if it's only a few, it might be simpler to modify the template and code the email addresses to the admin - especially if multiple staff members are replying to the same ticket. 0 Quote Link to comment Share on other sites More sharing options...
jawanet Posted September 30, 2016 Author Share Posted September 30, 2016 I have 4 staff sir, sometimes multiple staff member on ticket replay 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 30, 2016 Share Posted September 30, 2016 if it's only 4, then i'd be tempted to do this... <img src="https://www.gravatar.com/avatar/{if $reply.name eq 'John Smith'}jsmith@domain.com{elseif $reply.name eq 'Donald Trump'}donald@trump.com{/if}?s=30&d=mm" class="menu-avatar" alt=""> and add further elseif for each of your other two staff. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 1, 2016 Share Posted October 1, 2016 Can you fix this script? and add to hook. if you've already modified the template, then the Smarty code (which i've now corrected) should work without the need for any hook code. 0 Quote Link to comment Share on other sites More sharing options...
jawanet Posted October 1, 2016 Author Share Posted October 1, 2016 (edited) Great sir, work. Tanks very much for your time help me. Edited October 1, 2016 by jawanet 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.