» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 73
0 members and 73 guests
No Members online
Most users ever online was 611, 03-21-2008 at 11:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Tattoo - we are a group of tattoo enthusiasts
Gexa Energy - your absolute best choice in electric service
Texas electricity - save on electric rates
Oral Chelation - initial cleansing of your veins & arteries

Register Now! Contact Us

About this Page
This is a discussion on block phpbb2 user menu within the Purged Topics forums, part of the NM Staff category; For those of you that want the user menu block from nukemods and found that it doesnt work with php ...


Go Back   Nukemods Forum » NM Staff » Purged Topics

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-05-2002, 06:29 PM
Junior Member
 
Join Date: Dec 2002
Posts: 4
block phpbb2 user menu
For those of you that want the user menu block from nukemods and found that it doesnt work with php nuke 6.0 here is the entire code for the block and works on my site so it should work with your php nuke 6.0 site. List of problems i fixed.
1. Avatars were requested from wrong dir
2. Latest user when click pointed to wrong module
3. Members when clicked pointed to wrong module
4. Private message system didnt work gave tons of errors.

Granted i dont use phpbb2 so that prolly why it didnt work but I worked the code to where you dont have to have phpbb2 for the block to work properly. Ok heres the code. you can name the file what ever you want as long as it has the php extension and you upload it to /blocks/.

Code:
<?php

/*************************************************************************/
/* phpBB2 User Menu for PHP-Nuke 5.6
/* 18 August 2002
/* By: ThaiNuke :: PHP-Nuke Thailand (webmaster@thainuke.net)
/* http://www.thainuke.net
/* Thank for good scripts of Rugeri, NukeScripts
/*************************************************************************/

if (eregi("block-phpBB2_User_Menu.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content = "";

require_once("mainfile.php");
global $user, $cookie, $prefix, $user_prefix, $dbi, $anonymous, $userinfo, $Default_Theme;
getusrinfo($user);

cookiedecode($user);
$ip = getenv("REMOTE_ADDR");
$username = $cookie[1];
if (!isset($username)) {
    $username = "$ip";
    $guest = 1;
}
$past = time()-900;
sql_query("DELETE FROM $prefix"._session." WHERE time < $past", $dbi);
$result = sql_query("SELECT time FROM $prefix"._session." WHERE uname='$username'", $dbi);
$ctime = time();
if ($row = sql_fetch_array($result, $dbi)) {
    sql_query("UPDATE $prefix"._session." SET uname='$username', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$username'", $dbi);
} else {
    sql_query("INSERT INTO $prefix"._session." (username, time, host_addr, guest) VALUES ('$username', '$ctime', '$ip', '$guest')", $dbi);
}

$result = sql_query("select uname from $user_prefix"._users." order by uid DESC limit 0,1", $dbi);
list($lastuser) = sql_fetch_row($result, $dbi);
$result3 = sql_query("SELECT uid FROM ".$prefix."_users order by uid DESC limit 0,1", $dbi);
list($uidlast) = sql_fetch_row($result3, $dbi);
$numrows = sql_num_rows(sql_query("select uid from $user_prefix"._users."", $dbi), $dbi);
$result2 = sql_query("SELECT uname,guest FROM $prefix"._session." where guest=0", $dbi);
$member_online_num = sql_num_rows($result2, $dbi);
$who_online_now = "";
$i = 1;
while ($session = sql_fetch_array($result2, $dbi)) {
    if (isset($session["guest"]) and $session["guest"] == 0) {
	    $result5 = sql_query("SELECT uid FROM ".$prefix."_users where uname='$session[username]'", $dbi);
          list($uid) = sql_fetch_row($result5, $dbi);
        if ($i < 10) {
            $who_online_now .= "$i:<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$session[username]\">$session[username]</a>
\n";
        } else {
            $who_online_now .= "$i:<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$session[username]\">$session[username]</a>
\n";
        }
        $who_online_now .= ($i != $member_online_num ? "  " : "");
        $i++;
    }
}

// Calculate Who's Online
$result = sql_query("SELECT uname FROM $prefix"._session." where guest=1", $dbi);
$guest_online_num = sql_num_rows($result, $dbi);

$result = sql_query("SELECT uname FROM $prefix"._session." where guest=0", $dbi);
$member_online_num = sql_num_rows($result, $dbi);

$who_online_num = $guest_online_num + $member_online_num;

if (is_user($user)) {

    // For Members
    if ($userinfo[user_avatar]) {
		$content .= "
<center><img src=\"/images/forum/avatar/$userinfo[user_avatar]\" alt=\"\">
\n";
	}
	$content .= "
<center>Welcome, $username
</center>\n";
	$content .= "<center><a href=\"modules.php?name=Your_Account&op=logout\">Logout</a></center>

\n";
	$result = sql_query("select uid from $user_prefix"._users." where uname='$username'", $dbi);
    list($uid) = sql_fetch_row($result, $dbi);

    if (is_user($user)) {
    $content .= "
"._YOUARELOGGED." $username.
";
    if (is_active("Private_Messages")) {
	$result = sql_query("select uid from ".$user_prefix."_users where uname='$username'", $dbi);
	list($uid) = sql_fetch_row($result, $dbi);
	$result2 = sql_query("select to_userid from ".$prefix."_priv_msgs where to_userid='$uid'", $dbi);
	$numrow = sql_num_rows($result2, $dbi);
	$content .= ""._YOUHAVE." <a href=\"modules.php?name=Private_Messages\">$numrow</a> "._PRIVATEMSG."";
	}
    }
    $content .= "</center>
";
// Members Stats
$content .= "
<a href=\"modules.php?name=Members_List\"><img src=\"images/blocks/phpBB2_User_Menu/icon_profile.gif\" border=\"0\" ALT=\""._UMBMEMP."\"></a>"._UMBMEMP.":
\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_last.gif>"._UMBLATEST.": 
<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$lastuser\">$lastuser</a><img src=images/blocks/phpBB2_User_Menu/icon_new.gif>
\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_registered.gif>"._UMBOVER.": $numrows
\n";
// Who's Online
$content .= "
<a href=\"modules.php?name=Members_List\"><img src=\"images/blocks/phpBB2_User_Menu/icon_connect.gif\" border=\"0\" ALT=\""._UMBON."\"></a>"._UMBON."[$who_online_num]:
\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_users.gif>"._UMBVIS.": $guest_online_num
\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_registered.gif>"._UMBMEM.": $member_online_num
\n";
if ($member_online_num > 0) {
	$content .= "$who_online_now
";
}
	
} else {

	// For Anonymous
	$content .= "
<center><img src=\"images/blocks/phpBB2_User_Menu/icon_who.gif\" alt=\"\">
\n";
	$content .= "$anonymous
</center>\n";
	$content .= "<form action=\"modules.php?name=Your_Account\" method=\"post\">";
    $content .= ""._NICKNAME.":
<input type=\"text\" name=\"uname\" size=\"10\" maxlength=\"25\">
";
    $content .= ""._PASSWORD.":
<input type=\"password\" name=\"pass\" size=\"10\" maxlength=\"20\">
";
    $content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";
    $content .= "<input type=\"submit\" value=\""._LOGIN."\">
\n";
	$content .= "</form>";
	$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_dot.gif><a href=\"modules.php?name=Your_Account&op-new_user\">"._UMBREG."</a>
\n";
	$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_dot.gif><a href=\"modules.php?name=Your_Account&amp;op=pass_lost\">"._UMBLOST."</a>
\n";
// Members Stats
$content .= "
<a href=\"modules.php?name=Members_List\"><img src=\"images/blocks/phpBB2_User_Menu/icon_profile.gif\" border=\"0\" ALT=\""._UMBMEMP."\"></a>"._UMBMEMP.":
\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_last.gif border=\"0\" ALT=\""._UMBLATEST."\">"._UMBLATEST.": 
<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$uidlast\">$lastuser</a><img src=images/blocks/phpBB2_User_Menu/icon_new.gif>
\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_registered.gif border=\"0\" ALT=\""._UMBOVER."\">"._UMBOVER.": $numrows
\n";
$content .= "
<img src=\"images/blocks/phpBB2_User_Menu/icon_connect.gif\" border=\"0\" ALT=\""._UMBON."\">"._UMBON."[$who_online_num]
\n";
}





?>
it took me awile to decipher the code so i hope this helps you all out

Sputnik
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-05-2002, 07:09 PM
Member
 
Join Date: Nov 2002
Location: Michigan, USA
Posts: 359
Send a message via AIM to ReNeGaDe
thanks sputnik..i had thought this was fixed earlier, but apparently not..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-05-2002, 07:27 PM
coldblooded's Avatar
Super Moderator
 
Join Date: Jan 2002
Location: USA
Posts: 618
Re: block phpbb2 user menu
The user menu block listed in our downloads section is designed to work with PHP-Nuke 6 and the phpbb2 port. The "problems" fixed were actually just reversing the changes made to the original block for the use described in the description of the download. No disrepect intended towards Sputnik, I just don't want people to get the impression that the block we have available is "broken".
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-05-2002, 09:49 PM
Junior Member
 
Join Date: Dec 2002
Posts: 4
what didnt work at all
Correct the lil fixes for the links was the easy part and was intended for phpbb2 forum users. But the code for the private messages was intended for phpbb2 users hence making it look like it didnt work for php nuke. maybe a alternate version should be made since the user block does not work for standard php-nuke 6.0. It took a lil while to figure out what the actual problem was just trying to make it easier for ppl wanting to use the block. Below is what the actual private message problem was and how i fixed it.

Code to work with phpbb2
Code:
if (is_active("Private_Messages")) {
	$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where uname='$username'", $dbi);
	list($numrow) = sql_fetch_row($result, $dbi);
	if ($newnumrow == "0") {
	    $content .= ""._YOUHAVE." no "._PRIVATEMSG."";
	} else {	
	    $content .= ""._YOUHAVE." <a href=\"modules.php?name=Private_Messages\">$numrow</a> "._PRIVATEMSG."";
Code to work with standard php-nuke 6.0
Code:
if (is_user($user)) {
    $content .= "
"._YOUARELOGGED." $username.
";
    if (is_active("Private_Messages")) {
	$result = sql_query("select uid from ".$user_prefix."_users where uname='$username'", $dbi);
	list($uid) = sql_fetch_row($result, $dbi);
	$result2 = sql_query("select to_userid from ".$prefix."_priv_msgs where to_userid='$uid'", $dbi);
	$numrow = sql_num_rows($result2, $dbi);
	$content .= ""._YOUHAVE." <a href=\"modules.php?name=Private_Messages\">$numrow</a> "._PRIVATEMSG."";
Again this is to help ppl that couldnt figure out the problem and were forced to ditch the block. Basically I posted this so you were not asked on how to fix it. And other users could use the block. Sharing the knowledge you know.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-14-2002, 10:44 AM
Junior Member
 
Join Date: Dec 2002
Posts: 3
Hello I installed the user block at www.poolofgold.com/site but if the module is active, after a user is logged in I get the following..

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

can anybody help?

thanks marco
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 12-14-2002, 10:58 AM
Senior Member
 
Join Date: Sep 2002
Posts: 2,905
Originally Posted by marco
Hello I installed the user block at www.poolofgold.com/site but if the module is active, after a user is logged in I get the following..

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

can anybody help?

thanks marco
Hello. The problem you are having is more than likely because the phpBB users menu block that is DOWNLOADED from THIS site is for use with PHP-Nuke 6.0 and phpBB port 2.0.6 ONLY> You are using Splatt forums with your Nuke. This block will not work for you. Sorry.

We have plans to modify the block to make it work with Nuke 6.0 without the phpBB port. We'll try to get that download up soon.

If you are using the verison described above, make sure that when you create that block that the format of the script is correct. It sounds like that if you are using the above code, then your code is somehow gotten corrupted.

mikem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 12-14-2002, 03:10 PM
Junior Member
 
Join Date: Dec 2002
Posts: 4
marco if you copy the entire code that i put in the first post it will work. What is happening is that your private messages sql query is pointing to the wrong place. all you need to do is cut this code and over write the code in the user block.php file and save and itll
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 12-14-2002, 03:14 PM
Junior Member
 
Join Date: Dec 2002
Posts: 4
Originally Posted by mikem
Originally Posted by marco
Hello I installed the user block at www.poolofgold.com/site but if the module is active, after a user is logged in I get the following..

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

can anybody help?

thanks marco
Hello. The problem you are having is more than likely because the phpBB users menu block that is DOWNLOADED from THIS site is for use with PHP-Nuke 6.0 and phpBB port 2.0.6 ONLY> You are using Splatt forums with your Nuke. This block will not work for you. Sorry.

We have plans to modify the block to make it work with Nuke 6.0 without the phpBB port. We'll try to get that download up soon.

If you are using the verison described above, make sure that when you create that block that the format of the script is correct. It sounds like that if you are using the above code, then your code is somehow gotten corrupted.

mikem
I allready did all the work for you mikem short of zipping it up. The code i posted in my first post is the proper code to work for php nuke with splatt forums.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Block User Menu (at here) Jimmys444 Nuke 7.x - Blocks 1 03-12-2005 12:37 AM
Help with the User Menu Block Kristic Nuke 6.5 to 6.9 - Blocks 3 06-15-2003 10:37 PM
user menu block nokynoy Nuke 6.5 to 6.9 - Blocks 1 05-06-2003 02:34 PM
You have 0 private message(s)? Using phpBB2 User Menu Melkor Purged Topics 9 04-16-2003 04:32 PM
User Menu Block oneof1121 Purged Topics 4 02-21-2003 11:03 PM


All times are GMT -5. The time now is 08:04 AM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31