DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • May 19, 2013, 09:25:57 AM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: Discussion - Mail Keeper  (Read 881 times)
0 Members and 1 Guest are viewing this topic.
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« on: July 21, 2012, 12:29:10 PM »

Name Mail Keeper
Author Brendan for Sara
Version 1.1

Description
Keeps all mail even if they have been deleted and mega users can view them from the grotto, requested by Sara.
http://dragonprime.net/index.php?topic=12129.msg101044;topicseen#new

There is one small core edit

Code:
<?php
//open /lib/systemmail.php

//find line 40
$sql "INSERT INTO " db_prefix("mail") . " (msgfrom,msgto,subject,body,sent,originator) VALUES ('".$from."','".(int)$to."','$subject','$body','".date("Y-m-d H:i:s")."', ".($session['user']['acctid']).")";

//add this under it
//Mail keeper
if (db_table_exists(db_prefix('mailkeeper'))){
$mailkeeper "INSERT INTO " db_prefix("mailkeeper") . " VALUES ('','$from','$to','$subject','$body','".date("Y-m-d H:i:s")."','')";
db_query($mailkeeper);
}

//save
?>


Comments, suggestions

Download
http://dragonprime.net/index.php?topic=12145.msg101046;topicseen#new
« Last Edit: July 21, 2012, 12:46:28 PM by Brendan » Logged
Minato
Codemeister
****
Offline Offline

Posts: 269


Script not working? Just beat it!


View Profile WWW
« Reply #1 on: July 21, 2012, 12:42:24 PM »

<ghost>
 
 *floats in like the ghost of an old coder*

   Wooo! the upgrade unfriendliness!

</ghost>

Seriously though, nice job Brendan.  Wink Useful bit. Sure you don't want to release it for that 1.1.3 I've heard so much about?  Grin lol
« Last Edit: July 21, 2012, 12:47:17 PM by Minato » Logged

Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #2 on: July 21, 2012, 12:44:02 PM »

Yeah there isn't an hook for the systemmail to hook in too so i had too do a small core edit  Tongue

Quote
Seriously though, nice job Brendan.   Useful bit. Sure you don't want to release it for that 1.1.3 I've heard so much about?   lol

lol  Grin
« Last Edit: July 21, 2012, 12:49:58 PM by Brendan » Logged
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #3 on: July 24, 2012, 08:29:30 AM »

Amazing work...Is there a way to set a delete button in there.  So it will delete all YoMs in the Keeper but only have the delete button work for account 1?
Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #4 on: July 24, 2012, 08:41:06 AM »

Amazing work...Is there a way to set a delete button in there.  So it will delete all YoMs in the Keeper but only have the delete button work for account 1?

Attached.

EDIT: For those that don't want system mail appearing in the Mail Keeper, change the first line of the required core edit of lib/systemmail.php from:

Code:
<?php
if (db_table_exists(db_prefix('mailkeeper'))){
?>

to:

Code:
<?php
if (db_table_exists(db_prefix('mailkeeper')) && $from!=0){
?>
« Last Edit: August 18, 2012, 02:05:24 AM by Aeolus » Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #5 on: July 24, 2012, 08:56:10 AM »

Thank you so much!  It works great now!
Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #6 on: August 07, 2012, 02:26:11 PM »

Anyway to have a search function on it that works like the search on Letter Opener?  So that way you can see all the saved mail for one specific person.
Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #7 on: August 07, 2012, 07:30:20 PM »

Anyway to have a search function on it that works like the search on Letter Opener?  So that way you can see all the saved mail for one specific person.

Have you had a look at the Letter Opener code, and seen if you can implement it into this module?
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #8 on: August 08, 2012, 09:13:57 AM »

It has a search.  I saw it afterward but it doesnt work properly. I tried to use it and it returns nothing.  What I want now is for that to be fixed and for it to be changed and be like letter opener and only save the last x amount of YoMs, thats admin settable.  So that way it doesnt stop after sometime of working or lag bad.
« Last Edit: August 08, 2012, 09:17:53 AM by Megan|SaraBeth » Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #9 on: August 08, 2012, 09:19:23 AM »

It has a search.  I saw it afterward but it doesnt work properly. I tried to use it and it returns nothing.  What I want now is for that to be fixed and for it to be changed and be like letter opener and only save the last x amount of YoMs, thats admin settable.  So that way it doesnt stop after sometime of working or lag bad.

That should be easy. Have a look through the code, and when you find the database call that gets all the mail in the database table, add an limit command to the end of it.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #10 on: August 08, 2012, 04:15:27 PM »

So find the one that is used in the Letter Opener and use that and it would work?  And what about fixing the search function?
Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #11 on: August 09, 2012, 01:07:33 AM »

Edited module attached. (I got bored. I code when I get bored. xD)

  • Search now works.
  • Limit can be set in module settings
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
HunterD
Captain of the Guard
***
Offline Offline

Posts: 101



View Profile WWW
« Reply #12 on: August 15, 2012, 01:43:28 PM »

Limit's nice.. but how about paginating it so we can view additional messages from a "Page 2", etc. nav?

Something like...

Code:
<?php
 $mailperpage 
50;
       $sql "SELECT count(id) AS c from ".db_prefix("mailkeeper");
       $result db_query($sql);
       $row db_fetch_assoc($result);
       $totalpages ceil($row['c']/$mailperpage);
         
$page httpget("page");
       if ($page == "") {
     if (isset($session['mailkeeperPage'])){
   $page = (int)$session['mailkeeperPage'];
}else{
$page 1;
}
}
if ($page 1$page 1;
if ($page $totalpages$page $totalpages;
$session['mailkeeperPage'] = $page;

// No need to show the pages if there is only one.
if ($totalpages != 1)  {
addnav("Page");
for ($x=1$x <= $totalpages$x++){
if ($page == $x){
addnav(array("`b`#Page %s`0`b"$x),"runmodule.php?module=mailkeeper&page=$x");
}else{
addnav(array("Page %s"$x),"runmodule.php?module=mailkeeper&page=$x");
}
}
}
if ($page 1){
$limit = (($page-1) * $mailperpage) . "," $mailperpage;
}else{
$limit "$mailperpage";
}
?>

Only... working? xD

That's from the petition viewer, by the way.  Fastest thing I could think of. Ideas?
« Last Edit: August 15, 2012, 02:04:21 PM by HunterD » Logged

Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #13 on: August 15, 2012, 08:57:54 PM »

Limit's nice.. but how about paginating it so we can view additional messages from a "Page 2", etc. nav?

Clever idea, sir. I've already started working on it - I'll have something up by the end of the night.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Neltharion
Militia
**
Offline Offline

Posts: 55



View Profile WWW
« Reply #14 on: August 15, 2012, 10:20:10 PM »

Sounds good.
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
21 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search