Jump to content

Staff photo abd


eblanet77726

Recommended Posts

Heres a quick hack to show a Gravatar for your admin users.

 

Add the following code to the top of your viewticket.tpl file (in templates/YOURTEMPLATE directory)

 

{php}

$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; 
}{/php}

 

You can adjust grav_size to whatever size you'd like to use.

 

Then locate the following lines in the same file:

 


{foreach from=$descreplies key=num item=reply}
   <div class="{if $reply.admin}admin{else}client{/if}header">
       <div style="float:right;">{$reply.date}</div>
       {if $reply.admin}
           {$reply.name} || {$LANG.supportticketsstaff}
       {elseif $reply.contactid}
           {$reply.name} || {$LANG.supportticketscontact}
       {elseif $reply.userid}
           {$reply.name} || {$LANG.supportticketsclient}
       {else}
           {$reply.name} || {$reply.email}
       {/if}
   </div>
   <div class="{if $reply.admin}admin{else}client{/if}msg">

 

And replace it with this: (bolded text is added)

 


{foreach from=$descreplies key=num item=reply}
   <div class="{if $reply.admin}admin{else}client{/if}header">
       <div style="float:right;">{$reply.date}</div>
       {if $reply.admin}
           [b]{if $reply.gravatar}<img src="{$reply.gravatar}" />{/if}[/b]
           {$reply.name} || {$LANG.supportticketsstaff}
       {elseif $reply.contactid}
           {$reply.name} || {$LANG.supportticketscontact}
       {elseif $reply.userid}
           {$reply.name} || {$LANG.supportticketsclient}
       {else}
           {$reply.name} || {$reply.email}
       {/if}
   </div>
   <div class="{if $reply.admin}admin{else}client{/if}msg">

 

I used the default template as an example, you may need to adjust it to work with your template.

Link to comment
Share on other sites

I am relay try but don't work .

 

this its the viewticket.tpl code can you do the edit as you want ?

also please confirm are there any reuqest to do anything with this website http://en.gravatar.com/ to activate photo ?

 

 

 

 

<table class="page" cellpadding="0" cellspacing="0">

<tr>

<td class="pg_title">{$LANG.supportticketssubmitticket}</td>

</tr>

<tr>

<td class="pg_content">{if $error}

 

<p>{$LANG.supportticketinvalid}</p>

 

{else}

 

{literal}<script language="javascript">

$(document).ready(function(){

$("#addfileupload").click(function () {

$("#fileuploads").append("<input type=\"file\" name=\"attachments[]\" size=\"75\"><br />");

return false;

});

});

function rating_hover(id) {

var selrating=id.split('_');

for(var i=1; i<=5; i++){

if(i<=selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_pos.png)";

if(i>selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_neg.png)";

}

}

function rating_leave(id){

for(var i=1; i<=5; i++){

document.getElementById(id+'_'+i).style.background="url(images/rating_neg.png)";

}

}

function rating_select(id){

{/literal}window.location='viewticket.php?tid={$tid}&c={$c}&rating='+id;{literal}

}

</script>{/literal}

 

<p class="heading2">{$LANG.supportticketsviewticket} #{$tid}</p>

 

{if $errormessage}<div class="errorbox">{$errormessage|replace:'<li>':'  #  '}  #  </div><br />{/if}

 

<table cellspacing="1" cellpadding="0" class="frame"><tr><td>

<table width="100%" cellpadding="2">

<tr><td width="100" class="fieldarea">{$LANG.supportticketsdepartment}:</td><td>{$department}</td></tr>

<tr><td class="fieldarea">{$LANG.supportticketsdate}:</td><td>{$date}</td></tr>

<tr><td class="fieldarea">{$LANG.supportticketssubject}:</td><td>{$subject}</td></tr>

<tr><td class="fieldarea">{$LANG.supportticketsstatus}:</td><td>{$status}</td></tr>

<tr><td class="fieldarea">{$LANG.supportticketsticketurgency}:</td><td>{$urgency}</td></tr>

{foreach key=num item=customfield from=$customfields}

<tr><td class="fieldarea">{$customfield.name}:</td><td>{$customfield.value}</td></tr>

{/foreach}

</table>

</td></tr></table>

 

<br />

 

<div class="clientticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$user|replace:"<br />":" || "}</td><td align="right">{$date}</td></tr></table></div>

<div class="clientticketreply">{$message}{if $attachments}<br />

<br />

<b>{$LANG.supportticketsticketattachments}</b><br />

{foreach from=$attachments key=num item=attachment}

<img src="images/article.gif" align="middle" /> <a href="dl.php?type=a&id={$id}&i={$num}">{$attachment}</a><br />

{/foreach}{/if}</div>

 

{foreach key=num item=reply from=$replies}

 

<div class="{if $reply.admin}admin{else}client{/if}ticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$reply.user|replace:"<br />":" || "}</td><td align="right">{$reply.date}</td></tr></table></div>

<div class="{if $reply.admin}admin{else}client{/if}ticketreply">{$reply.message}{if $reply.attachments}<br />

<br />

<b>{$LANG.supportticketsticketattachments}</b><br />

{foreach from=$reply.attachments key=num item=attachment}

<img src="images/article.gif" align="middle" /> <a href="dl.php?type=ar&id={$reply.id}&i={$num}">{$attachment}</a><br />

{/foreach}{/if}

{if $reply.admin && $ratingenabled}{if $reply.rating}<table align="right" cellspacing="0" cellpadding="0">

<tr height="16">

<td>{$LANG.ticketreatinggiven}&nbsp</td>

<td width="16" background="images/rating_{if $reply.rating>=1}pos{else}neg{/if}.png"></td>

<td width="16" background="images/rating_{if $reply.rating>=2}pos{else}neg{/if}.png"></td>

<td width="16" background="images/rating_{if $reply.rating>=3}pos{else}neg{/if}.png"></td>

<td width="16" background="images/rating_{if $reply.rating>=4}pos{else}neg{/if}.png"></td>

<td width="16" background="images/rating_{if $reply.rating>=5}pos{else}neg{/if}.png"></td>

</tr></table>{else}<table align="right" cellspacing="0" cellpadding="0">

<tr height="16" onmouseout="rating_leave('rate{$reply.id}')" style="cursor: pointer; cursor: hand;">

<td>{$LANG.ticketratingquestion}&nbsp</td>

<td onmouseover="rating_hover('rate{$reply.id}_1')" onclick="rating_select('rate{$reply.id}_1')"><b>{$LANG.ticketratingpoor} </td>

<td width="16" id="rate{$reply.id}_1" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td>

<td width="16" id="rate{$reply.id}_2" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td>

<td width="16" id="rate{$reply.id}_3" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td>

<td width="16" id="rate{$reply.id}_4" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td>

<td width="16" id="rate{$reply.id}_5" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td>

<td onmouseover="rating_hover('rate{$reply.id}_5')" onclick="rating_select('rate{$reply.id}_5')"><b> {$LANG.ticketratingexcellent}</td>

</tr></table>{/if}<br /><br /><br />{/if}</div>

 

{/foreach}

 

{if $showclosebutton}

<p align="center"><input type="button" value="{$LANG.supportticketsstatuscloseticket}" onclick="window.location='/viewticket.php?tid={$tid}&c={$c}&closeticket=true'" class="closeticket" /></p>

{/if}

 

<p><strong> »  {$LANG.supportticketsreply}</strong></p>

 

<form method="post" action="viewticket.php?tid={$tid}&c={$c}&postreply=true" enctype="multipart/form-data">

 

<table cellspacing="1" cellpadding="0" class="frame"><tr><td>

<table width="100%" cellpadding="2">

<tr><td width="120" class="fieldarea">{$LANG.supportticketsclientname}</td><td>{if $loggedin}{$clientname}{else}<input type="text" name="replyname" size=30 value="{$replyname}" />{/if}</td></tr>

<tr><td class="fieldarea">{$LANG.supportticketsclientemail}</td><td>{if $loggedin}{$email}{else}<input type="text" name="replyemail" size=50 value="{$replyemail}" />{/if}</td></tr>

<tr><td colspan="2" class="fieldarea"><textarea name="replymessage" rows="12" cols="60" style="width:100%">{$replymessage}</textarea></td></tr>

<tr><td class="fieldarea">{$LANG.supportticketsticketattachments}:</td><td><input type="file" name="attachments[]" size="75" /> <a href="#" id="addfileupload"><img src="images/add.gif" align="absmiddle" border="0" /> {$LANG.addmore}</a><br />

<div id="fileuploads"></div>

({$LANG.supportticketsallowedextensions}: {$allowedfiletypes})</td></tr>

</table>

</td></tr></table>

 

<p align="center"><input type="submit" value="{$LANG.supportticketsticketsubmit}" class="button" /></p>

 

</form>

 

{/if}

</td>

</tr>

<tr>

<td class="pg_footer"> </td>

</tr>

</table>

Link to comment
Share on other sites

Sorry, I dont use version 4 so I cant test it. A few things that jump out, you'll need to replace "descreplies" with "replies" in the php block that goes on the top, then add the {if reply.gravitar} section where you want the image to display.

 

With regards to the gravatar website, you'll want each of your support members to register an account there, linked to their email address. Then upload their photo. gravatar is basically a universal avatar creator that links to email addresses. A ton of websites use it, so you can simply create an account there and add all of your email addresses, and you'll have the same avatar/picture for any site that uses it.

Link to comment
Share on other sites

  • 1 month later...
Sorry, I dont use version 4 so I cant test it. A few things that jump out, you'll need to replace "descreplies" with "replies" in the php block that goes on the top, then add the {if reply.gravitar} section where you want the image to display.

 

With regards to the gravatar website, you'll want each of your support members to register an account there, linked to their email address. Then upload their photo. gravatar is basically a universal avatar creator that links to email addresses. A ton of websites use it, so you can simply create an account there and add all of your email addresses, and you'll have the same avatar/picture for any site that uses it.

 

I love the gravatar for the admin users! Is there anyway to allow clients to add one? I'm sure this would require some modification to the database so the image can be stored and queried for each user..

Link to comment
Share on other sites

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