WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Vbulletin Login in Sidebar (12 posts)

  1. fatalx
    Member
    Posted 4 years ago #

    Hello,

    I need to put in a vbulletin login on in the sidebar of my wordpress theme.

    I got some code that works well alone (without wordpress) but gives errors with wp.

    Here it is.

    In the header before <html> I put this

    $root = $_SERVER['DOCUMENT_ROOT'];
    $curdir = getcwd ();
    chdir("$root/forums/");
    require("$root/forums/global.php");
    chdir ($curdir);
    ?>

    Then to get the login/welcome box I put this in

    <?php
    if ($vbulletin->userinfo['userid']!=0) {
    
    $username= $vbulletin->userinfo['username'];
    echo ("<p>Welcome back, $username!<br /></p>");
    }
    
     else { echo "LOGIN STUFF GOES HERE!";
    }
    ?>

    Now when I put that into wordpress it doesn't work. I get these errors.

    Warning: array_keys() expects parameter 1 to be array, null given in [path]\includes\functions.php on line 4243

    Warning: Invalid argument supplied for foreach() in [path]\includes\functions.php on line 4243

    Fatal error: Call to a member function query_read_slave() on a non-object in [path]\forums\includes\functions.php on line 3205

    Anyone have any idea?

  2. fatalx
    Member
    Posted 4 years ago #

    I was able to get rid of the errors by moving the top code

    $root = $_SERVER['DOCUMENT_ROOT'];
    $curdir = getcwd ();
    chdir("$root/forums/");
    require("$root/forums/global.php");
    chdir ($curdir);

    Into WP_CONFIG but now they calling of vbulletin->userinfo['userid']
    and $vbulletin->userinfo['username'] doesn't do anything.

    where should I go from here?

  3. fatalx
    Member
    Posted 4 years ago #

    After many hours of trying to figure this out I got the desired results. Here is what I did to get a Vbulletin login box on my wordpress page that includes a welcome message.

    In the wp-config.php file I add this code to the bottom

    $root = $_SERVER['DOCUMENT_ROOT'];
    $curdir = getcwd ();
    chdir("$root/forums/");
    require("$root/forums/global.php");
    chdir ($curdir);

    Then in my sidebar file I added this code

    <?php
    global $vbulletin;
    if ($vbulletin->userinfo['userid']!=0) {
    
    $username= $vbulletin->userinfo['username'];
    echo ("<p>Welcome back, $username!</p>");
    }
    
     else { echo "LOGIN STUFF GOES HERE!";
    }
    ?>

    I hope this helps other people out, and hopefully I don't run into anymore major issues.

  4. adchased
    Member
    Posted 4 years ago #

    Damn, thanks fatalx, you rock!

  5. bluerob
    Member
    Posted 4 years ago #

    Ok, but for the "login stuff goes here" area, what do I put so the user can login? I need code for the login. I tried making my own, but couldn't quiet get it. Any help would be great!

    Thanks!

  6. fatalx
    Member
    Posted 3 years ago #

    Hey,

    @ everyone who needs the LOGIN STUFF GOES HERE! code here is what it should look like. I haven't touched this code for awhile so i'm not 100% sure if this is correct but it should be something like this.

    <form action="path-to-your-forum/forums/login.php?do=login" method="post">
    <input type="hidden" name="do" value="login" />
    <input type="hidden" name="url" value="path-back-to-your-original-page" />
    <input type="hidden" name="vb_login_md5password" />
    <input type="hidden" name="vb_login_md5password_utf" />
    <input type="hidden" name="s" value="" />
    <input type="hidden" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" />
    <label>Username:<input name="vb_login_username" type="text" id="login" tabindex="1" class="bginput" accesskey="u"/></label>
    <label>Password<input name="vb_login_password" type="password" id="password" tabindex="1" class="bginput" /></label>
    <input name="submit" type="submit" id="submit" tabindex="1" value="Login" accesskey="s" class="button" />
    </form>
  7. Kitmitsu
    Member
    Posted 3 years ago #

    I've done all of this and it worked. However, after adding the code to wp-config.php, certain parts of the WordPress panel stop working. I can't upload images via Add Post and more annoyingly, I can't edit any of the plugin settings without getting a "You do not have sufficient permissions to access this page" error. These errors go away when I remove the code from wp-config.

    I've tried every fix I can possibly think of. Please tell me someone has some idea how I can fix this?

    Thanks.

  8. Kitmitsu
    Member
    Posted 3 years ago #

    Please help someone ;_;

  9. Kitmitsu
    Member
    Posted 3 years ago #

    Seriously, someone! I'll be forever in your debt!

  10. fatalx
    Member
    Posted 3 years ago #

    have you tried disabling some of your plugins?

  11. Kitmitsu
    Member
    Posted 3 years ago #

    I've tried disabling all of them. The code just interferes with the wordpress config file somehow. I've also found that you can't use 90% of WordPress's functions with it giving me the insufficient permissions error.

  12. Tom
    Member
    Posted 3 years ago #

    Try moving the code to a different part of your wp-config file.. Eg.. move it further up or down the file.

    I am by no means a genius when it comes to php, but in the past I've done this to get things to work.

Topic Closed

This topic has been closed to new replies.

About this Topic