PDA

View Full Version : [Release vB 2.0.3] Different Stuff When Logged In/Out


SystemLogic
27 Sep 2001, 07:21
This hack was done by FireFly (http://www.vbulletin.com/forum/member.php?s=&action=getinfo&userid=5755) and I am just re-posting it here just in case anybody needs it.

This hack is a very simple idea, yet can be very useful in getting new members to register.

When you go onto a VB board, there is a welcome message for unregistered users, right? Well what I wanted to do was setup like a personal features box like www.sitepointforums.com, but I didn't want it to show up when you are an unregistered user. So basically I needed the same sort of thing, a "welcome message" that showed up only to registered users.

Here's the hack:

In index.php, replace:

$unregwelcomemessage='';
if ($bbuserinfo['userid']==0) {
eval("\$unregwelcomemessage = \"".gettemplate('forumhome_unregmessage')."\";");
}

with:

$welcomemessage='';
if ($bbuserinfo['userid']==0) {
eval("\$welcomemessage = \"".gettemplate('forumhome_unregmessage')."\";");
} else {
eval("\$welcomemessage = \"".gettemplate('forumhome_regmessage')."\";");
}

Then in your forumhome template, replace $unregwelcomemessage with $welcomemessage

Then make a new template called forumhome_regmessage.

Then just use the forumhome_regmessage template for your message for registered users and your forumhome_unregmessage template for unregistered users.

You can view a live demo at http://www.systemlogic.net/boards, notice the top when you are unregistered, and then feel free to register and notice the top now has a "Your Personal Features" box (Which is the code in my forumhome_regmessage template).

Here's a screenshot of both just in case you don't feel like taking the time to register:

Chen
27 Sep 2001, 07:42
Finally someone is doing the job for me. Thanks. :)

Neo
27 Sep 2001, 09:22
umm i cant get it to work.. when i did it the first time the same opening was there just what i put was in the middles of it all. and then i tryed to edit the new temp and nothing showed up. can someone help

Neo
27 Sep 2001, 09:36
nevermind that last message i figured it out. but i would like to know if i can have to member and non-member messages. i would like to keep the top one and use a stats area in a different place. would i be able to do that

Chen
27 Sep 2001, 09:38
Can you repeat that, I'm sure I understand you. :confused:

SystemLogic
27 Sep 2001, 11:50
Yeah I'm a little confused too....member and non-member messages.....is that not the same thing as a registered/non-registered person?

Neo
27 Sep 2001, 12:16
yes. and nevermind i figured it out. i guess i was to lazy to do it myself:rolleyes:

RobAC
27 Sep 2001, 14:42
I looked for the original hack from FireFly, but couldn't find it. Where is the code for the box and options once logged in?

SystemLogic
27 Sep 2001, 15:25
That was just something I did on my own.....Basically whatever you want to show up for registered users goes into the temple forumhome_unregmessage and anything you want to show to your logged in/registered users goes to forumhome_regmessage

If anybody is interested in me posting how I did the personal features box let me know. Also if you want that code for the not logged in users, let me know (personally I think it is more effective and looks better than the standard welcome text).

RobAC
27 Sep 2001, 15:40
I think your examples look awesome. Would you mind posting the code if it isn't too much trouble?

SystemLogic
27 Sep 2001, 15:49
Sure, not a problem.

Alright in forumhome_regmessage I have this (Note: you may have to edit some of the colors and stuff to fit your site accordingly):

<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td><normalfont>Welcome to our newest member, <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid"><b>$newusername</b></a></normalfont></td>
<td align="right"><smallfont><b>$newposts</b></smallfont></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#000000"><tr><td>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="#537290">
<td colspan="5"><font color="#FFFFFF"><b>SLBoards Stats</b></font></td>
</tr>
<tr bgcolor="#E9E9E9">
<td colspan="5">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<smallfont>
Registered Members: <b>$numbermembers</b><br>
Total Threads: <b>$totalthreads</b> | Total Posts: <b>$totalposts</b> | Total Views: <b>$totalviews</b>
</smallfont>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#8CAECF">
<td colspan="5">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td><b>Your Personal Features</b></td>
<td align="right"><smallfont>Logged in as $bbuserinfo[username] <a href="member.php?s=$session[sessionhash]&action=logout">[logout]</a></smallfont></td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#E9E9E9">
<td align="center"><smallfont><a href="usercp.php?s=$session[sessionhash]" title="Click Here to Open Your Control Panel">Control Panel</a></smallfont></td>
<td align="center"><smallfont><a href="private.php?s=$session[sessionhash]" title="Click Here to Open Your Private Messages $inboxname">Private Messages</a><br>
$newpm[messages] new ($allpm[messages] total)</smallfont></td>
<td align="center"><smallfont><a href="#" onclick="popup('buddy.php', 'Window', 200, 260);" title="Click Here to Launch Your Buddy List">Launch Buddy List</a></smallfont></td>
<td align="center"><smallfont><a href="member2.php?s=$session[sessionhash]&action=viewsubscription" title="Click Here to View Your Subscribed Threads">Subscribed Threads</a></smallfont></smallfont></td>
<td align="center"><smallfont>$bbuserinfo[posts] SLPoints<br><a href="memberlist.php?s=$session[sessionhash]&what=topposters&perpage=50">View top 50</a></smallfont></td>
</tr>
</table>
</td></tr></table>

For the forumhome_unregmessage I used this code:

<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#000000"><tr><td>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="#8CAECF">
<td colspan="5"><b>You Are Not Registered Or Not Logged In - <font color="red">Important: Read Below</font></b></td>
</tr>
<tr bgcolor="#E9E9E9">
<td width="65%" valign="top"><smallfont>If you are not registered & logged in, you may still post, but with limited features. You may register by <a href="register.php?s=$session[sessionhash]">clicking here</a>. If you have questions be sure to check out our <a href="misc.php?s=$session[sessionhash]&action=faq">FAQ</a>.</smallfont></td>
<td align="right" width="45%">
<table border="0" cellpadding="0" cellspacing="0">
<form action="member.php" method="post">
<tr>
<td nowrap><input type="hidden" name="s" value="$session[sessionhash]">
<input type="hidden" name="action" value="login">
<input type="text" class="bginput" name="username" size="7">
<input type="password" class="bginput" name="password" size="7">
<input type="submit" class="bginput" value="Login"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td></tr></table>

<br>

<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td><normalfont>Welcome to our newest member, <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid"><b>$newusername</b></a></normalfont></td>
<td align="right"><smallfont><b>$newposts</b></smallfont></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#000000"><tr><td>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="#537290">
<td colspan="5"><font color="#FFFFFF"><b>SLBoards Stats</b></font></td>
</tr>
<tr bgcolor="#E9E9E9">
<td colspan="5">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<smallfont>
Registered Members: <b>$numbermembers</b><br>
Total Threads: <b>$totalthreads</b> | Total Posts: <b>$totalposts</b> | Total Views: <b>$totalviews</b>
</smallfont>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr></table>

Also, for the Launch Buddy List feature, you need to install the popup buddy list hack...I'm not exactly sure where it is in here, but if you search you'll be able to find it.

Also, for the Total Thread Views thing I have, you need to install that hack as well. I posted it in this forum, so just search for posts by me, and you'll be able to find that.

That's about it :)

If you have any questions, let me know.

Neo
27 Sep 2001, 16:51
would you know how to add a users ava to the members login stuff when logged in and the admins ava to the non-registered area?

RobAC
28 Sep 2001, 15:14
Thanks! This works very well! :)

JJR512
29 Sep 2001, 10:23
Hey, what's up with the javascript link to launch the buddies list? The link doesn't work for me...I suspect there is additional code that needs to go somewhere else to get that to work. Can you share that as well?

Chen
29 Sep 2001, 10:27
I think it's a part of this hack:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=14079