Author Topic: [CODE] - Admin Profile Notes  (Read 1815 times)

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 505
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
[CODE] - Admin Profile Notes
« on: August 24, 2015, 09:20:44 AM »
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

Code: [Select]
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.php


to admin > processors



Now, open admin > profile.php and around line 134 find:

Code: [Select]
<?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

Code: [Select]
<?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

Code: [Select]
// 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}&amp;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:

Code: [Select]
/******** 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

Code: [Select]
<?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

Code: [Select]
<?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 :)

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: [CODE] - Admin Profile Notes
« Reply #1 on: August 24, 2015, 10:54:06 AM »
Thanks for sharing.
Just installed, works perfect!

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: [CODE] - Admin Profile Notes
« Reply #2 on: August 25, 2015, 11:56:02 AM »
I was just thinking about this a couple of weeks ago. I'm glad you shared this. :)
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

flyer5

  • Active Member
  • ***
  • Posts: 96
  • Karma: +4/-0
    • North East Nudists
Re: [CODE] - Admin Profile Notes
« Reply #3 on: September 03, 2015, 07:32:43 AM »
Another great add on KH! Cheers...

Now... can you adapt this slightly so I can run it on the cpanel.htm page and use it to post notices to other admins/mods... each notice will need an edit and delete button....

:)

F5

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 505
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: [CODE] - Admin Profile Notes
« Reply #4 on: September 04, 2015, 12:46:52 PM »
Another great add on KH! Cheers...

Now... can you adapt this slightly so I can run it on the cpanel.htm page and use it to post notices to other admins/mods... each notice will need an edit and delete button....

:)

F5

Can't see why not :) ill look into and get back to you :)

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: [CODE] - Admin Profile Notes
« Reply #5 on: September 28, 2015, 10:19:29 AM »
I filled out a long note in the text box. When I clicked on Save, portions of the note were cut off. Only 3 lines of text are visible. Is there a way to prevent this or have the box automatically expand to fit all of the text?
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 505
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: [CODE] - Admin Profile Notes
« Reply #6 on: September 28, 2015, 03:39:40 PM »
I filled out a long note in the text box. When I clicked on Save, portions of the note were cut off. Only 3 lines of text are visible. Is there a way to prevent this or have the box automatically expand to fit all of the text?

If portions of the note get cut off then i'm assuming the note exceeded the default 300 length limit which is set in the database for notes.

Simply access your database and go to the admin_notes table. If you click structure then click change on the profile_note column and change the 300 to whatever you feel is more reasonable.

I've also updated the original post to include the purging of notes in the event of account deletion.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: [CODE] - Admin Profile Notes
« Reply #7 on: September 29, 2015, 12:30:19 AM »
I filled out a long note in the text box. When I clicked on Save, portions of the note were cut off. Only 3 lines of text are visible. Is there a way to prevent this or have the box automatically expand to fit all of the text?

If portions of the note get cut off then i'm assuming the note exceeded the default 300 length limit which is set in the database for notes.

Simply access your database and go to the admin_notes table. If you click structure then click change on the profile_note column and change the 300 to whatever you feel is more reasonable.

I've also updated the original post to include the purging of notes in the event of account deletion.

Great! Thanks for the tips. :)
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: [CODE] - Admin Profile Notes
« Reply #8 on: June 28, 2016, 02:34:09 AM »
Am using this mod for month now, thanks for sharing. It's working perfect. It has becoing a great help for me as admin.

My question is:  Is it possible to expand this mod to also allow members to put notes on other members profiles. In my opinion it could be a great solution which helps those members with memory issues when they come back to a particular member profile they have visited some time ago and put a note on it.

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 505
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: [CODE] - Admin Profile Notes
« Reply #9 on: June 28, 2016, 07:18:19 AM »
Am using this mod for month now, thanks for sharing. It's working perfect. It has becoing a great help for me as admin.

My question is:  Is it possible to expand this mod to also allow members to put notes on other members profiles. In my opinion it could be a great solution which helps those members with memory issues when they come back to a particular member profile they have visited some time ago and put a note on it.


Can't see why not. Will have a look shortly, little behind on things atm lol :)

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: [CODE] - Admin Profile Notes
« Reply #10 on: June 28, 2016, 11:54:00 AM »
Quote
Can't see why not. Will have a look shortly, little behind on things atm lol :)

Thanks for considering.

Would be great if there will be an option to add that feature to "Access Levels".

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: [CODE] - Admin Profile Notes
« Reply #11 on: August 30, 2016, 09:02:53 AM »
Hello KHDev,
something going on with notes on other members profiles similar to Admin profile notes?

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 505
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: [CODE] - Admin Profile Notes
« Reply #12 on: September 03, 2016, 07:37:14 AM »
Hello KHDev,
something going on with notes on other members profiles similar to Admin profile notes?

Hey,

sorry seemed to have slipped under the radar.

Will look into it by the end of the month :)

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: [CODE] - Admin Profile Notes
« Reply #13 on: September 03, 2016, 08:21:40 AM »
Thanks,
take your time.

Omololu

  • Active Member
  • ***
  • Posts: 45
  • Karma: +0/-0
Re: [CODE] - Admin Profile Notes
« Reply #14 on: September 28, 2016, 04:15:44 AM »
File not found, where can I download it