Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Auth vBulletin and moving members

Quote Reply
Auth vBulletin and moving members
Hi,

I have an existing Gossamer Links 3.10 installation, and I just purchased vBulletin. I installed auth_vBulletin, and it seems to work, but I do have a few members that were already signed up via GL and they cannot automatically login via the vB. How do I move them over? I also have about 85 LSQL members, but only like 10% of them actually have links attached to them. Is there a way to sort out the users who have no links attached and delete them?

Also, I'm guessing that when someone clicks "Add a link" and they get redirected to the LSQL join form, I need to change that to go to the vB join form, right? How do I do that?

Thanks!
Quote Reply
Re: [Evoir] Auth vBulletin and moving members In reply to
I took a look at the plugin code and it doesn't look like existing users should be affected by the plugin. If their username is the same as their vBulletin username and they log into vBulletin, then it should automatically log them into Gossamer Links. If you send me admin panel access and a user's login/password that's having the problem, I can take a look at it for you.

Adrian

Last edited by:

brewt: May 15, 2006, 1:54 PM
Quote Reply
Re: [Evoir] Auth vBulletin and moving members In reply to
In Reply To:
Also, I'm guessing that when someone clicks "Add a link" and they get redirected to the LSQL join form, I need to change that to go to the vB join form, right? How do I do that?
The easiest way is to modify the login.html template and insert the login box from the vBulletin forum home page. Make sure you include the 'Remember me' checkbox as well.

It's been a while since I modified mine, but I think the following code added to the vBulletin login form will allow you to redirect users back to where they came from before authentication e.g. the 'Add Link' page:

Code:
<input type="hidden" name="forceredirect" value="1" />
<input type="hidden" name="url" value="<%url%>" />
Quote Reply
Re: [aus_dave] Auth vBulletin and moving members In reply to
Thanks. I copied the login box, but not what happens is that it accepts my login, and returns me to the login page each time. Also, now they GLinks does not recognize if I am logged in or not. It just offers me the login screen each time. So, it is an endless cycle. I must be doing something wrong.
Quote Reply
Re: [Evoir] Auth vBulletin and moving members In reply to
These are all the hidden input fields for my login form - see if yours are the same.

Code:

<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="forceredirect" value="1" />
<input type="hidden" name="url" value="<%url%>" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />

Was the Auth_vBulletin plugin working ok before? Just checking to make sure it's not something else.
Quote Reply
Re: [aus_dave] Auth vBulletin and moving members In reply to
Thanks for your help. It is appreciated. Smile The system allows me to login, vB redirects me back to the login page, as if I am not logged in. I'm sure it is something simple, but I can't figure out what it would be that I am doing wrong.


Here is the code that I moved over from my vB html output from the home page login box:

This is the js from the page. It seems like it deals with the "remember me" cookie.

<script type="text/javascript">
<!--
function log_out()
{
ht = document.getElementsByTagName("html");
ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
if (confirm('Are you sure you want to log out?'))
{
return true;
}
else
{
ht[0].style.filter = "";
return false;
}
}
//-->
</script>

And here is the form itself. I've added the hidden inputs you mentioned.

<!-- login form -->
<form action="/talk/login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>

<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="forceredirect" value="1" />
<input type="hidden" name="url" value="<%url%>" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />

<table cellpadding="0" cellspacing="3" border="0">
<tr>
<td class="smallfont"><label for="navbar_username">User Name</label></td>
<td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" /></td>
<td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />Remember Me?</label></td>

</tr>
<tr>
<td class="smallfont"><label for="navbar_password">Password</label></td>
<td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" accesskey="p" tabindex="102" /></td>
<td><input type="submit" class="button" value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" /></td>
</tr>
</table>

</form>
<!-- / login form -->

Last edited by:

Evoir: May 22, 2006, 12:27 AM
Quote Reply
Re: [aus_dave] Auth vBulletin and moving members In reply to
Oh, yes, it seems that the plugin works ok. Not sure how to tell, exactly. But, it does tell me that I have successfully logged in on the vB redirect page. It just redirects me back to the login page each time.

Last edited by:

Evoir: May 22, 2006, 12:28 AM
Quote Reply
Re: [Evoir] Auth vBulletin and moving members In reply to
In Reply To:
Oh, yes, it seems that the plugin works ok. Not sure how to tell, exactly.
Firstly, is your site static (using builds) or dynamic? My experiences with this plugin as mentioned above are only on dynamic sites.

If your site is dynamic, add some code to the left or right sidebar to show if a user is actually logged in:

Code:
<%if Username%>
<p>Welcome, <strong><%Username%></strong>!</p>
<%else%>
<p>Welcome, <strong>Guest</strong>!<br/></p>
<p>Please <a href="/forums/register.php">Register</a> or <br/><a href="/cgi-bin/user.cgi">Login</a></p>
<%endif%>

I don't use the login/logout code that comes standard in the Links templates, or the Javascript routine in include_common_head.html. The Auth_vBulletin plugin handles the authentication on the Links side and users register/login/logout on the vB side.
Quote Reply
Re: [aus_dave] Auth vBulletin and moving members In reply to
Thanks for the responses. I have a static site. It does seem to be logging the user in, but vB just spits them back to the edited GLinks login page each time (asking user to login again) It's like the referring page is wrong. Frown

Last edited by:

Evoir: May 22, 2006, 9:47 PM
Quote Reply
Re: [Evoir] Auth vBulletin and moving members In reply to
I don't think you are going to be able to refer them back to the right page with a static site. You will probably need to let logged in users land on the forum home page and then have them navigate back to where they want to be.

It's really only an issue for users when they first login - the cookie should remember them in subsequent sessions, making a login not required.
Quote Reply
Re: [aus_dave] Auth vBulletin and moving members In reply to
Yes it can be done, I did it a while back and will try and remember what exactly I did tomorrow as it is getting late now, basically it involves making a new VB login.php page, adding a function and making a new functions_login.php page . You also need SSI, here is a php file that you can insert with SSI on your static pages where you want the login details displayed, obviously changing the path to your VB. It won't work on dynamic pages.

<?php
chdir("/full/path/to/forum");
require('../forum/global.php');
include('../forum/includes/functions_user.php');

// if logged in
if ($vbulletin->userinfo['userid'])
{
echo "<a href=/forum/login.php?$session[sessionurl]do=logout&amp;logouthash=$logouthash";
echo $vbulletin->userinfo['logouthash'];
echo ">";
echo " Log Out";
echo "</a>";
}

// if not logged in
if ($vbulletin->userinfo['userid'] == '')
{
print '<A href="/forum/register.php" rel="nofollow">Register</A>';
if ($vbulletin->userinfo['userid'] == 0)
{
echo "<a href=\"/cgi-bin/dir/user.cgi?url=" . $_SERVER['REQUEST_URI'] . "\" rel=\"nofollow\">Login</a>";
}
}
?>

the $_SERVER['REQUEST_URI'] will get passed along to the user.cgi file so in your new form in login.html you will add this

<input type="hidden" name="redirect" value="<%if url%><%url%><%endif%>" >

Last edited by:

garrynz: May 23, 2006, 3:58 PM
Quote Reply
Re: [garrynz] Auth vBulletin and moving members In reply to
Ok here goes, let me know if this doesn't work as I did this on my site a while ago and I may have missed something.

Make a new copy your forum login.php script and rename it login_links.php

Change

define('THIS_SCRIPT', 'login');

to

define('THIS_SCRIPT', 'login_links');

require_once(DIR . '/includes/functions_login.php');

to

require_once(DIR . '/includes/functions_login_links.php');



open (backup) /include/functions.php

find

eval('print_output("' . fetch_template('STANDARD_REDIRECT') . '");');
exit;
}

add after

###### added for links login ######

function standard_redirect_links($message = '', $forceredirect = false)
{
global $header, $footer, $headinclude, $forumjump;
global $timezone, $vbulletin, $vbphrase, $stylevar, $pagestarttime;
$redirect = urldecode($_GET['redirect']);
static
$str_find = array('"', '<', '>'),
$str_replace = array('&quot;', '&lt;', '&gt;');
if ($vbulletin->db->explain)
{
$pageendtime = microtime();
$starttime = explode(' ', $pagestarttime);
$endtime = explode(' ', $pageendtime);
$totaltime = $endtime[0] - $starttime[0] + $endtime[1] - $starttime[1];
$vartext .= "<!-- Page generated in " . vb_number_format($totaltime, 5) . " seconds with " . $vbulletin->db->querycount . " queries -->";
$querytime = $vbulletin->db->time_total;
echo "\n<b>Page generated in $totaltime seconds with " . $vbulletin->db->querycount . " queries,\nspending $querytime doing MySQL queries and " . ($totaltime - $querytime) . " doing PHP things.\n\n<hr />Shutdown Queries:</b><hr />\n\n";
exit;
}
if ($vbulletin->options['useheaderredirect'] AND !$forceredirect AND !headers_sent() AND !$vbulletin->GPC['postvars'])
{
exec_header_redirect($vbulletin->url);
}
$title = $vbulletin->options['bbtitle'];
$pagetitle = $title;
$errormessage = $message;
$url = urldecode($_POST["redirect"]);
$url = str_replace($str_find, $str_replace, $url);
$js_url = $url; // " has been replaced by &quot;
define('NOPMPOPUP', 1); // No footer here
require_once(DIR . '/includes/functions_misc.php');
$postvars = construct_hidden_var_fields($vbulletin->GPC['postvars']);
$formfile =& $url;
($hook = vBulletinHook::fetch_hook('redirect_generic')) ? eval($hook) : false;
eval('print_output("' . fetch_template('STANDARD_REDIRECT_LINKS') . '");');
exit;
}

####### end added for links login #######


Make a new copy of functions_login.php and name it functions_login_links.php

find

$vbulletin->url == 'login.php'

and change to


$vbulletin->url == 'login_links.php'

find

eval(print_standard_redirect('redirect_login', true, true));

and change to

eval(standard_redirect_links('redirect_login', true, true));


Now with that SSI script you should get redirected after logging in. Everytime you update VB you will need to put in that code in functions.php

Last edited by:

garrynz: May 24, 2006, 12:46 AM