vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Integration with vBulletin - Simple vB User login and access control on non vB pages (https://vborg.vbsupport.ru/showthread.php?t=173693)

Digma 03-30-2009 12:40 PM

We've just start re-coding our main website and one of the things on our wishlist was to integrate the vb login sequence and have vb help determine what 'non-registered' users can or can't do. Easy to use, easy to install and works like a charm. It has also encouraged me to look further into this and see what else is possible. Excellent work and thank you for this simple but very effective mod. :up:

Billspaintball 11-13-2009 09:19 AM

Just a brief heads up for anyone who is interested, initial testing shows that this works with vB4 beta 3

aspen0 11-14-2009 12:45 PM

thanks for that headsup Bill. I was about to come ask that. I've come to rely on this script a bit over the years (actually, an older version I think) and wanted to make sure it'd still work with the upgrade.

AndyAA 12-14-2009 08:34 PM

Quote:

Originally Posted by MadsK (Post 1691512)
I found the trick to make it happen.

Below is the code i use for my site. It has been altered a little with some extra links after you've logged in but they can be changed. I've tested it with a couple of different friends on different computers, operating systems and browsers and it works on all of them.

With that said this is only working with Wordpress as it collects the cookie from the wordpress database and outputs it. When logging out it also clears both wordpress and vbulletin cookie!

I would really like some feedback on it :)

You can see it in action on my website http://www.swtorcommunity.com

Code:

<?php
// Version 2.00
// Released March 21st, 2008
// For vB 3.7.x
// Edit the line below to show path to your forums
$forumpath = "/forum/";


// You dont have to edit anything underneath here,
// but you can if you wish to style the login box
// to match the style of your site.

// ---------------
// COPYRIGHT STUFF
// ---------------
// You are free to use and modify this script in anyway you like.
// However,
// - Do not remove copyright notice
// - Dont pass it off as your own work.
//
// This script is provided free of charges, however If you use this on a commercial
// venture a small paypal donation to cwp@cwp.id.au would be apprecieated.


// We check if user is logged in
                if (isset($user_ID)) {
                        // User is logged in
                        echo "<div id=loginwelcome>";
                        $user_info = get_userdata($user_ID);
                        echo $before_widget . $before_title . __("Welcome "). $user_info->display_name . $after_title;
                        echo "</div>";
// If logged in display logout link
echo "<br />";

echo "<div id=loginmeta>";

echo "<a href=\"".$forumpath."usercp.php";
echo "\">";
echo "User CP</a>";

echo "<a href=\"".$forumpath."private.php";
echo "\">";
echo "Private Messages</a>";

echo "<a href=\"".$forumpath."search.php";
echo "\">";
echo "Search</a>";

echo "<a href=\"/wp-login.php?action=logout\">Logout</a>";

echo "</div>";

} else { // If user is not logged in, we do this stuff

// Display login boxes + button
// You can style this with html or CSS as normal if desired.
echo"
        <form id=loginform action=\"".$forumpath."login.php\" method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
        <script type=text/javascript src=\"".$forumpath."clientscript/vbulletin_md5.js\"></script>
       
        <input name=vb_login_username value=Username id=user onFocus=this.value='' type=text id=navbar_username size=10 />
                       
        <input name=vb_login_password type=password id=password size=10 value=Password onFocus=this.value='' />
        <br />
               
        <label id=rememberme for=cb_cookieuser_navbar>Remember Me?<input name=cookieuser type=checkbox id=cb_cookieuser_navbar value=1 checked=checked />
        </label>
       
               
        <input type=submit id=submit value=Login title=$vbphrase[enter_username_to_login_or_register] value=\"Log In\" />
               
        <input type=hidden name=s value=$session[sessionhash] />
        <input type=hidden name=do value=login />               
        <input type=hidden name=vb_login_md5password />
        <input type=hidden name=vb_login_md5password_utf />

        </form>
";

}
?>



You are a champion!!!!

I have been looking everywhere for a Wordpress login.

You made my day!


How can I display some user info ie: user photo/thread count/new messages like this mod:

https://vborg.vbsupport.ru/showthread.php?t=173698


Thanks again and hope you can help out

Andy

archaosus 01-05-2010 11:23 AM

So a quick question regarding user authentication as I got this working really well now - at the moment it is checking for user ID "6" which is admin - non admins are moved to the site frontpage and information isnt loaded - however what I would like to do is have multiple usergroups able to access the page - ie 6,12,13 - would I then just change the code to

Code:

<?php
If ($vbulletin->userinfo['6,12,13']!=0)

or would I have to make nested id statements?

Ipuck 01-19-2010 01:03 AM

Does any one know if I can use this mod on my site if the forums is in a subdomain? when I add: require_once('/path/to/your/forums/global.php'); the page goes blank.

mandingo 01-19-2010 01:21 AM

Quote:

Originally Posted by Ipuck (Post 1959785)
Does any one know if I can use this mod on my site if the forums is in a subdomain? when I add: require_once('/path/to/your/forums/global.php'); the page goes blank.


/path/to/your/forums
needs to be the actual path to your forum root.
if you need:
Open up a text editor and paste this in it:
PHP Code:

<?
echo getcwd();
?>

and name the file
path.php
make sure it's path.php and not path.php.txt or anything like that.
Upload that file to your forum root and point your browser to it.
example:
http://yourforum.org/forum/path.php
should show you what you need to replace /path/to/your/forums with. delete that file when you're done with it.
Hope this helps.

Ipuck 01-19-2010 01:31 AM

Thank you for your quick response. I actually did add the path to the forum, but still doesnt work. This is what I got:

Quote:

<?php
$curdir = getcwd ();
chdir('/var/www/vhosts/mydomain.com/subdomains/mysubdomain/httpdocs/forum/');
require_once('global.php');
chdir ($curdir);
?>
It should work, but unfortunately it doesn't. I just don't understand why it doesn't work.

I also tried:

Quote:

<?php
$curdir = getcwd ();
chdir('/var/www/vhosts/mydomain.com/subdomains/mysubdomain/httpdocs/forum/');
require_once(''/var/www/vhosts/mydomain.com/subdomains/mysubdomain/httpdocs/forum/global.php');
chdir ($curdir);
?>

mandingo 01-19-2010 02:06 AM

Quote:

Originally Posted by Ipuck (Post 1959802)
Thank you for your quick response. I actually did add the path to the forum, but still doesnt work. This is what I got:



It should work, but unfortunately it doesn't. I just don't understand why it doesn't work.

I also tried:

pm me the link to path.php on your server.

metalguy639 02-03-2010 02:45 AM

Quote:

Originally Posted by Billspaintball (Post 1913471)
Just a brief heads up for anyone who is interested, initial testing shows that this works with vB4 beta 3

Great but is there a fix for this cookies problem that everyone is having. I used this hack before and never had it do this before so it must be something to do with vb 3.8.4.

wolbrom 04-22-2010 01:47 PM

Has this scrip been confirmed with vB4 (release) yet?

thenewuser 05-31-2010 10:56 PM

Thank you for this!

Right now I am getting a:

Fatal error: Call to a member function query_read() on a non-object in (path)/www/www/forums/includes/adminfunctions.php on line 2399

When it is loaded into a file with WordPress. It does work in a stand alone PHP file.

If you can help me debug this I shall donate! (Basically paying for your services as is only fair.)

I am using 3.8.5.

Hex_legend 07-22-2010 06:26 PM

My demo site is www.gungeuk.com/newdesign and the forums are at www.gungeuk.com/forum

On my site, I have /includes/header.php and /includes/sidebar.php.

On the sidebar is where I want to put the login box, so in my header, I put the code:

PHP Code:

<?php
$curdir 
getcwd ();
chdir('/home/gungeuk1/public_html/forum/');
require_once(
'/home/gungeuk1/public_html/forum/global.php');
chdir ($curdir);
?>

and in the sidebar, I have:

PHP Code:

<?php
   
require_once('/home/gungeuk1/public_html/forum/login_inc.php');
?>

where the login box is to go.

However, when I login, it will log me in but still shows the login box on the sidebar.

In my ACP cookie path settings, its saved to /

My path can be found at www.gungeuk.com/forum/path.php

Please let me know how I can get it to show me as logged in.

Thanks

Leigh

fake83 07-28-2010 12:53 PM

same problem here

NinjaKiwi 04-04-2011 01:22 AM

Any chance of a solution to this problem for VB4?

theloller 04-23-2011 01:52 PM

Quote:

Originally Posted by fake83 (Post 2075750)
same problem here

help us :confused:


All times are GMT. The time now is 01:05 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01421 seconds
  • Memory Usage 1,776KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete