Members   Search      Help    Register    Login    Home
Home » Discussion Forums » M0dZ & HaCkZ » AJAX PM Checking
AJAX PM Checking [message #2147] Sat, 19 July 2008 19:34 Go to next message
Revan is currently offline Revan  Czech Republic
Messages: 125
Registered: April 2007
Super-Seeder
What this mod does is that it checks the database every 30s (or whatever time you set), and if the user has new pm it returns a pop up about it asking if you want to go to your inbox.

First you need to copy both of the files I'm attaching to the base directory where you have pmbt.
Then you need to open header.php, find this line:
echo "<body>\n";
and change it to this:
echo "<body onload=\"pm_ajax()\">\n";

Then add this line:
echo "<script type=\"text/javascript\" src=\"pm_ajax.js\"></script>";
before:
echo "<title>".$sitename."</title>\n";


After that find this line:
include("blocks/usercp.php");
and add before it these lines:
$pm_div = ($has_newpm) ? "pm_notif" : "nopm_notif";
echo "<div id=\"".$pm_div."\"></div>";




Next you need to add this line to language/english.php
define("_jscriptconfirmtext","You have a new PM, please click OK to go to your PM Inbox.");


spanish.php:
define("_jscriptconfirmtext","Tienes un nuevo Mensaje Privado, da click en OK para ir a tu Bandeja de Entrada de Mensajes Privados.");
brazilian.php:
define("_jscriptconfirmtext","Voce tem uma nova mensagem, por favor clique OK para ir para sua caixa de mensagens.");
czech.php:
define("_jscriptconfirmtext","Mate novou PM, kliknete na OK pro prechod do schranky.");


If you want to set the pm check for a different interval (not the default 30s), then open pm_ajax.js and change the number 30000 to any number you want (the number is in ms) in this line:
window.setInterval('sendPmId()', 30000);


That's it Smile


If you'd want to have the pop up of new pm even when you load the page and know about the pm then just add these lines to header.php:
if ($has_newpm)
{
  echo "<script type=\"text/javascript\" language=\"JavaScript\">";
  echo "sPath = window.location.pathname;";
  echo "sPage = sPath.substring(sPath.lastIndexOf('/') + 1);";
  
  echo "if (sPage != \"pm.php\"){ var answer = confirm (\""._jscriptconfirmtext."\");";
  echo "if (answer) window.location=\"pm.php?op=inbox\";";
  echo "}";
  echo "</script>";

}
before this line:
include("blocks/usercp.php");
But this part of the code is not needed for functionality..

Enjoy!
  • Attachment: pm_ajax.js
    (Size: 2.55KB, Downloaded 87 times)
  • Attachment: pm_ajax.php
    (Size: 0.88KB, Downloaded 78 times)
Re: AJAX PM Checking [message #2148 is a reply to message #2147] Sat, 19 July 2008 20:42 Go to previous messageGo to next message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
I well be looking into this for my complete new Ajax system!
would like to also have send & receive with Ajax to.
trying to bring down server load and by taking out allot of unneeded queries should do it and Ajax seems to fit the bill.


http://a.imageshack.us/img831/5562/mybikes.png
Re: AJAX PM Checking [message #2154 is a reply to message #2148] Sun, 20 July 2008 12:10 Go to previous messageGo to next message
Revan is currently offline Revan  Czech Republic
Messages: 125
Registered: April 2007
Super-Seeder
joeroberts wrote on Sat, 19 July 2008 12:42

I well be looking into this for my complete new Ajax system!
would like to also have send & receive with Ajax to.
trying to bring down server load and by taking out allot of unneeded queries should do it and Ajax seems to fit the bill.

Should be working fine, it's basically just a modded version of what I have on my site working, so hopefully without bugs Smile

As for the send and receive by ajax, I'll think about it, I'm not sure how receive would exactly work, but sending shouldn't be too much of a problem - I'll try to do it when I have some time Smile
Re: AJAX PM Checking [message #2215 is a reply to message #2148] Sat, 13 September 2008 14:30 Go to previous message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
joeroberts wrote on Sat, 19 July 2008 15:42

I well be looking into this for my complete new Ajax system!
would like to also have send & receive with Ajax to.
trying to bring down server load and by taking out allot of unneeded queries should do it and Ajax seems to fit the bill.

This has been tested and installed in next release!!!!


http://a.imageshack.us/img831/5562/mybikes.png
Previous Topic:Additional Anti-cheat check
Next Topic:Last IP in view profile
Goto Forum:
  


Current Time: Wed Feb 08 12:25:42 GMT 2012

Total time taken to generate the page: 0.00697 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software