PDA

View Full Version : Some q's


SupaJ
01-22-2005, 03:06 PM
Hello, I'm designing my website and I want to integrate it with Vbulletin.
I have added a userpanel with the following script:


<?

if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];

print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>");

} else {

?>
<form action='forums/login.php' method='post' onsubmit='md5hash(vb_login_password,vb_login_md5pa ssword)'>
<script type='text/javascript' src='forums/clientscript/vbulletin_md5.js'></script>

<span class="sectionheader">Username:</span>
<input type='text' class='button' name='vb_login_username' id='navbar_username' size='15' accesskey='u' tabindex='1' value='' onfocus='if (this.value == 'username') this.value = '';' /><br>

<span class="sectionheader">Password:&nbsp;</span>
<input type='password' class='button' name='vb_login_password' size='15' accesskey='p' tabindex='2' /><br>
<input type='checkbox' name='cookieuser' value='1' tabindex='3' id='cb_cookieuser_navbar' accesskey='c' checked='checked' /><span class='sectionheader'>Remember Me</span><br>


<input name="submit" type='submit' class='button' accesskey='s' tabindex='4' title='Log In' value='Log In' />
<input type='hidden' name='do' value='login' />
<input type='hidden' name='forceredirect' value='1' />
<input type='hidden' name='vb_login_md5password' />
</form>
<?

}

?>


which I got from this site (I forgot by wo, if somebody tells me who i'll give the appropriate credits), when you are logged in it brings you back and changes the login thing to "Welcome back" but instead of that I want it to display the avatar, the last time you were online and the amount of private msg's read and unread. How do I do this?

my 2nd question is:
How do I add the amount of posts on the forums on my main site?

thanks in advance

Andreas
01-22-2005, 03:13 PM
To get the avatar

$avatarurl = fetch_avatar_url($bbuserinfo[userid]);


PMs are in $bbuserinfp[pmunread] & $bbuserinfo[pmtotal]
Last activity is in $bbuserinfo[lastactivity] as a UNIX timestamp.

To get the total amount of posts
SELECT COUNT(*) AS totalposts FROM post

SupaJ
01-22-2005, 04:28 PM
To get the avatar

$avatarurl = fetch_avatar_url($bbuserinfo[userid]);


PMs are in $bbuserinfp[pmunread] & $bbuserinfo[pmtotal]
Last activity is in $bbuserinfo[lastactivity] as a UNIX timestamp.

To get the total amount of posts
SELECT COUNT(*) AS totalposts FROM post
thanks alot, but i cant get lastactivity to work?

with the total posts i mean, to give me the number of posts on the main site.

Andreas
01-22-2005, 04:31 PM
thanks alot, but i cant get lastactivity to work?

What's the problem with it?


with the total posts i mean, to give me the number of posts on the main site.
The query I posted does give you the total number of posts on your board.
Isn't that what you want?

SupaJ
01-22-2005, 04:37 PM
What's the problem with it?


The query I posted does give you the total number of posts on your board.
Isn't that what you want?
well i added it to my site and it gives me this

[avatar] Welcome, SupaJ!
You were last active at
You have 0 unread pms from a total of 0 pms.

it doesnt give me any date, is there any file i need to include for it?


with the posts i mean a string on my site that changes everytime the post number changes, so i dont have to update it manually

Andreas
01-22-2005, 04:42 PM
it doesnt give me any date, is there any file i need to include for it?

That's more then strange, should definitly work.
Maybe you got a typo?

with the posts i mean a string on my site that changes everytime the post number changes, so i dont have to update it manually
The query I posted does that.
Do you need PHP-Code too?
So here we go:


$posts = $DB_site->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "post");

And then use $posts[total] in your template.

SupaJ
01-22-2005, 04:47 PM
postcount is working thanks alot!! :D

$lastactive=$bbuserinfo['lastactivity'];

print("<align='left'><span class='sectionheader'><br />&nbsp;<img src='forums/$avatarurl'> Welcome, $username!<br />You were last active at $lastactivity<br />You have <strong>$pmunread</strong> unread pms from a total of <strong>$pmtotal</strong> pms.");

I don't think i've made a typo... I've included two files.
global.php for username and /includes/functions_user.php for the avatar, the pm's just worked maybe I need to include another thing for lastactivity

edit: I made a typo, i see it now sorry lol
I will most definatly include your name in the final credits

You were last active at 1106415842
huh? isn't that in unix thingy? how do i convert that to normal time...

sorry for double post

Andreas
01-22-2005, 04:59 PM
As I said, it's a unix timestamp ;)

If you want a readable date

$lastactivitystr = vbdate($vboptions['dateformat] . ' ' . $vboptions['timeformat'], $bbuserinfo['lastactivity']);


Or you could also try to use $bbuserinfo['lastvisitdate'], this should already be formatted.

SupaJ
01-22-2005, 05:17 PM
As I said, it's a unix timestamp ;)

If you want a readable date

$lastactivitystr = vbdate($vboptions['dateformat] . ' ' . $vboptions['timeformat'], $bbuserinfo['lastactivity']);


Or you could also try to use $bbuserinfo['lastvisitdate'], this should already be formatted.
thanks it worked!! :D