Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
izone
Involved
Involved


Joined: Sep 07, 2004
Posts: 354
Location: Sweden

PostPosted: Thu Sep 16, 2004 10:01 am Reply with quote

I was looking for a way to make the new pm pop up for user be shown in the first login insted of when the user goes to the forum. (As you know normally when you first go to the forum section you get a pop up for new pm)

And I found this:

Code:


/*****READ ALL OF THE DIRECTIONS CAREFULLY!!!*********
*****MAKE BACKUPS OF YOUR FILES PRIOR TO EDITING*****/

/*************************************************
 * phpBB 2.1 Port Popup New PM's Hack          *
 *                                               *
 * Written by: feignofdeath aka Elantra          *
 *                                               *
 * This hack enables the New PM window to popup  *
 * anywhere in the site that a user browses,     *
 * and not just in the Forums!!!!                *
 *                                               *
 * Please follow the directions carefully!       *
 * (hack tested with phpNuke 6.0 & * 2.0.6 port  *
 *                                               *
 * http://webpromod.sourceforge.net              *
 *************************************************/
 
modules/Forums/includes/page_header.php:

Replace this line (line 262):
$s_privmsg_new = 1;

With this:
$s_privmsg_new = 0;


blocks/block-Who_is_online.php  (Note: This block must be on the lefthand side for the popup to appear @ every location, if you don't use this block follow alternate step)

Add this chunk on the line before ?> (line 65)
cookiedecode($user);
$username = $cookie[1];
$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where username='$username'", $dbi);
list($numrow) = sql_fetch_row($result, $dbi);
if ($numrow > 0) {
   $content .= "<s cript language='javas cript'>\n"
             ."<!--\n"
             ."var win = window.open('modules.php?name=Private_Messages&popup=1&mode=newpm', '', 'height=225,width=400')"
             ."//-->\n"
             ."</s cript>";
}

/////////////////// END OF HACK UNLESS YOU NEED ALTERNATE BLOCK STEP /////////////////////

Alternate Step for 2nd part of hack

first make sure that the block at least has a statement that reads:
global $user, $cookie, $prefix, $dbi, $user_prefix;

this line should be near the top  (normally within the first 10 lines of code)
if not add that line as for this hack needs it.

You should now be able to copy this code into any block you want that shows up in the lefthand side:

cookiedecode($user);
$username = $cookie[1];
$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where username='$username'", $dbi);
list($numrow) = sql_fetch_row($result, $dbi);
if ($numrow > 0) {
   $content .= "<s cript language='javas cript'>\n"
             ."<!--\n"
             ."var win = window.open('modules.php?name=Private_Messages&popup=1&mode=newpm', '', 'height=225,width=400')"
             ."//-->\n"
             ."</s cript>";
}

/////////////////// END OF ALTERNATE BLOCK STEP HACK ///////////////////////////////////

If you have a problem... Post on the boards @ http://webpromod.sourceforge.net


But when I do as he says and activate "Who is online" block I get this error:

Code:


Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/SITENAME/public_html/SITENAME/includes/sql_layer.php on line 286


(in this message I changed the name of site to SITENAME).

and in this file (sql_layerphp) on line 286 the code is:
Code:


$row = mysql_fetch_row($res);


So I don't know how to fix it. Or if anybody has a better way to do it?

I've sent an email to the address in the s cript and dosn't got any answer yet. I use nuke 7,5 withe phpbb 2.0.10.

By the way: there was no modules/Forums/includes/page_header.php insted I find this file in include/page_header.php.

Please help.
Regards

OBS! because of Sentinel is running here I change every s-c-r-i-p-t words to s cript!
 
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Thu Sep 16, 2004 11:11 am Reply with quote

To see more information about the error, try this Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
izone
PostPosted: Thu Sep 16, 2004 12:21 pm Reply with quote

Thank you Raven.

I've added the code and it give me the same error message as before.

What shall I do?

Regards
 
Raven
PostPosted: Thu Sep 16, 2004 12:29 pm Reply with quote

It should also have displayed the query that would identify the table that has the problem. Did it not?
 
izone
PostPosted: Thu Sep 16, 2004 12:38 pm Reply with quote

No Raven. I just gott this code:

Code:


Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/iranzon/public_html/iranyad/includes/sql_layer.php on line 286
 
 
izone
PostPosted: Thu Sep 16, 2004 12:43 pm Reply with quote

and in my sql_layer.php file from line 285 is like this:

Code:


case "MySQL":
        $row = mysql_fetch_row($res);
        echo mysql_error();
        return $row;
    break;;
 
Raven
PostPosted: Thu Sep 16, 2004 12:45 pm Reply with quote

Line 286 is not the issue Smile. Try this. In includes/sql_layer.php, set $sql_debug to 1. Then load the page again.
 
izone
PostPosted: Thu Sep 16, 2004 12:51 pm Reply with quote

Now I get this:

Code:


SQL query: select user_new_privmsg from nuke_users where username='admin'

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/iranzon/public_html/iranyad/includes/sql_layer.php on line 286


Thank you Raven to giving me your time.
 
Holbrookau
Hangin' Around


Joined: Jun 25, 2004
Posts: 32

PostPosted: Thu Sep 16, 2004 8:51 pm Reply with quote

This mod was written for PHP-Nuke6.0 and uses the old sql layer. You will need to add the variable $dbi to the global line in that block.
In blocks/block-Who_Is_Online.php -
Find:
Code:
global $user, $cookie, $prefix, $db, $user_prefix;
Replace it with:
Code:
global $user, $cookie, $prefix, $db, $user_prefix, $dbi;
 
View user's profile Send private message
izone
PostPosted: Fri Sep 17, 2004 2:10 am Reply with quote

It works it works...

Thank you very much Raven, Thank you very much Holbrookau!

You are the best! RavensScripts Laughing
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©