Jump to content

Display all customers sticky notes on Admin Summary page


Recommended Posts

Hi,

 

I'm not sure if this has already been done but I use Sticky Notes to record additional work that needs to be invoiced at a later date but kept on forgetting who I'd done extra work for.

 

So I've created a widget for the Admin Summary page that displays all the Sticky Notes with links through to the Customers Note and also the customer summary.

 

sticky_notes.jpg

 

Just create a new file in modules/widgets and paste this code in. Then head over to Setup > Staff Management > Administrator Roles > Edit and scroll down to Widgets and then tick yours (in this example it's called "Display Customer\'s Sticky Notes".

 

This was tested in Version: 5.3.11. it works on my install but it if breaks yours or makes the sky fall down, I'm not liable...

 

?php
# WHMCS Widget to display sticky notes on the Admin Summary
# Hedley Phillips - Digital Essence
if (!defined("WHMCS"))
   die("This file cannot be accessed directly");

function widget_display_sticky_notes() {

$content = '<table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;" cellspacing="1">
<tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>Customer</td><td>Note</td><td>Modified</td></tr>';

$x=1; $range = "<= 364";
   $result = mysql_query("SELECT * FROM `tblnotes` JOIN tblclients ON tblclients.id=tblnotes.userid  WHERE `sticky` = '1'");
   while ($data = @mysql_fetch_array ($result)) {
	 $noteid = $data["id"];
	 $userid = $data["userid"];
	 $firstname = $data["firstname"];
        $lastname = $data["lastname"];
	 $note = $data["note"];
	 $date = $data["modified"];
       $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="/whmcsadmin/clientssummary.php?userid='.$userid.'">'.$firstname. ' ' .$lastname.'</a></td><td><a href="/whmcsadmin/clientsnotes.php?userid='.$userid.'&action=edit&id='.$noteid.'">'.$note.'</a></td><td>'.$date.'</td></tr>'; $x=0;
   }
   if($x) $content =  '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No Sticky Notes to display</td></tr>';
$content .= '</table>';

   return array( 'title' => 'Display Customer\'s Sticky Notes', 'content' => $content );
}

add_hook("AdminHomeWidgets",1,"widget_display_sticky_notes");

?>

 

NOTE:

 

What I can't get to work is the edit function.

 

I'm using:

 

<a href="/whmcsadmin/clientsnotes.php?userid='.$userid.'&action=edit&id='.$noteid.'">

 

where:

 

$noteid = $data["id"];

$userid = $data["userid"];

 

but it keeps on putting the customer id in both $userid and $noteid and I can't work out why.

Edited by Dgital Essence
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.

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