Sometimes its useful to leave notes on profiles in the admin panel so admins and mods can keep track of their interaction with the member for support reference ect... (Notes are only visible in the admin panel)
Admins and Mods can add notes. Each note is tagged with the admin/mod name and time for reference.
Only admins have the ability to delete notes.
Example
A user is warned about uploading fake profile pictures by a moderator. So then the moderator can record that a message/email was sent regarding the issue by leaving a note on their profile so admins and moderators can keep track. That way its easy to know if the user is a repeat offender.
It can also be useful to make a note if the profile is a 'stock' profile, if they win an account upgrade in contest or something.
How To Install
Firstly download the
profile_note_add.php and
profile_note_delete.php processor files which you can download by
Clicking Here
Then,
Create a new table for admin notes :1) Access your database and choose the table you use for your etano site
2) Click the SQL tab
copy and paste this into the textarea and click Save/Go
CREATE TABLE `dsb_admin_notes` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT , `profile_id` INT(10) UNSIGNED NOT NULL , `profile_note` VARCHAR(300) NOT NULL , `note_by` VARCHAR(25) NOT NULL , `note_by_dept` TINYINT(1) UNSIGNED NOT NULL , `added` DATETIME NOT NULL , PRIMARY KEY (`id`) ) ENGINE = MyISAM;
Now, in the download pack upload:
profile_note_add.php
profile_note_delete.phpto
admin > processors
Now, open admin > profile.php and around line 134 find:<?php
#######################################################
// FIND THIS LINE
#######################################################
$output['pic_width']=get_site_option('pic_width','core_photo');
#######################################################
// JUST ABOVE THE LINE ADD
#######################################################
$loop=array();
$query="SELECT *,UNIX_TIMESTAMP(`added`) as `added` FROM `{$dbtable_prefix}admin_notes` WHERE `profile_id`=$uid ORDER BY `id` ASC";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
while ($rsrow=mysql_fetch_assoc($res)) {
$rsrow['profile_note']=htmlspecialchars(sanitize_and_format($rsrow['profile_note'],TYPE_STRING,$__field2format[TEXT_DB2DISPLAY]));
$rsrow['added']=strftime($config['datetime_format'],$rsrow['added']+$config['time_offset']);
if (!empty($rsrow['note_by_dept']) && $rsrow['note_by_dept']==2) {
$rsrow['note_by_dept']='Moderator';
} elseif (!empty($rsrow['note_by_dept']) && $rsrow['note_by_dept']==4) {
$rsrow['note_by_dept']='Administrator';
}
$loop[]=$rsrow;
}
if (!empty($_SESSION[_LICENSE_KEY_]['admin']['dept_id']) && $_SESSION[_LICENSE_KEY_]['admin']['dept_id']==4) {
$output['is_admin']=true;
}
Now, near the bottom of the page find <?php
// Find this
$tpl->set_loop('categs',$categs);
// Add this below it
$tpl->set_loop('loop',$loop);
// Find this
$tpl->process('content','content',TPL_MULTILOOP | TPL_OPTIONAL);
// Change it to
$tpl->process('content','content',TPL_MULTILOOP | TPL_NOLOOP | TPL_OPTIONAL);
// Find this
$tpl->drop_loop('categs');
// Add this below it
$tpl->drop_loop('loop');
unset($loop);
and SAVE
Now open admin > skin > profile.html// find this
<!--loop name="categs"-->
<div class="profile_cat" id="cat_{categs.pcat_id}">
<h3>{categs.pcat_name}</h3>
<ul class="cat_content">
<!--loop name="cat_content"-->
<li id="row_{cat_content.dbfield}"><label>{cat_content.label}:</label> <p>{cat_content.field}</p></li>
<!--/loop name="cat_content"-->
</ul>
</div>
<!--/loop name="categs"-->
// add this below it
<div class="profile_notes">
<h2>Profile Notes</h2>
<ul class="profile_notes_list">
<!--loop name="loop"-->
<li>
<p class="note_by">{loop.note_by} ({loop.note_by_dept}) on {loop.added} <!--opt name="output.is_admin"--> - <a href="processors/profile_note_delete.php?nid={loop.id}&return={output.return2me}" onclick="return(confirm('Are you sure you want to delete this note?'))">Delete</a><!--/opt name="output.is_admin"--></p>
<p class="profile_note">{loop.profile_note}</p>
</li>
<!--noloop name="loop"-->
<li id="no_notes">
<p>There are no notes attached to this user..</p>
</li>
<!--/noloop name="loop"-->
<!--/loop name="loop"-->
</ul>
</div>
<div class="add_note">
<form action="processors/profile_note_add.php" method="post" id="profile_note" class="form_table">
<input type="hidden" name="profile" value="{output.fk_user_id}" />
<input type="hidden" name="return" value="{output.return2me}" />
<h2>Add Note</h2>
<p id="html_warning">Plain text only. The use of HTML will simply make the note unreadable due to security. </p>
<textarea cols="" rows="5" name="note_body" id="note_body" tabindex="1"></textarea>
<input type="submit" class="button" value="Save" id="btn_save" tabindex="2" />
</form>
</div>
and SAVE!
Now open admin > skin > styles > profile.css and add:
/******** Profile Note ********/
.profile_notes {
margin: 40px 0px;
}
.profile_notes ul.profile_notes_list li {
border: 1px solid #e1e1e1;
margin-top: 5px;
}
.profile_notes ul.profile_notes_list li p.note_by {
padding: 5px;
background-color: #e1e1e1;
}
.profile_notes ul.profile_notes_list li p.profile_note {
padding: 5px;
}
.profile_notes ul.profile_notes_list li#no_notes p {
padding: 5px;
text-align: CENTER;
background-color: #e1e1e1;
}
.add_note {
margin: 40px 0px;
}
.add_note p#html_warning {
padding: 5px;
text-align:center;
background: #FAD1D1;
}
.add_note form#profile_note h2 {
background: #e1e1e1;
color: #525252;
}
.add_note form#profile_note textarea {
display: block;
width: 80%;
margin:10px auto;
}
.add_note form#profile_note input[type="submit"] {
display: block;
margin: 10px auto;
}
And SAVE!
Purge related notes when an account is deleted.
Open
tools > cron > jobs > 120 > 1delete_members.php<?php
##### Around line 25 will do, add this ######
$query="DELETE FROM `{$dbtable_prefix}admin_notes` WHERE `profile_id` IN ('".join("','",$all_uids)."')";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
Open
admin > processors > member_delete_now.php<?php
##### Around line 39 will do, add ######
$query="DELETE FROM `{$dbtable_prefix}admin_notes` WHERE `profile_id` IN ('".join("','",$all_uids)."')";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
and that should be it. Let me know of any issues.
Enjoy
