1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

vBulletin login on WordPress

Discussion in 'WordPress' started by ResaleBroker, Jun 21, 2005.

  1. #1
    I want to include a vBulletin "login" on a WordPress page. [Example Page]

    If I add the vBulletin code to the WordPress code I receive the following message: "Unable to add cookies, header already sent."

    Here is the code in question:
     
    <?php get_header(); ?>
    
    <?php 
      chdir("/home/sales/public_html/forums/"); 
    require('/home/sales/public_html/forums/global.php');
    chdir("./");
    ?>
    
    PHP:
    Does anyone have any ideas on how to get this to work? :confused:
     
    ResaleBroker, Jun 21, 2005 IP
  2. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #2
    You can't get it by using php. Use a form.
     
    noppid, Jun 21, 2005 IP
  3. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #3
    I've been using this form on a non-WP page and it works fine. When I use this form on a WP page it logs the user in but instead of the "welcome user" message the login boxes remain. Any ideas?

    <?
    if ($bbuserinfo['userid']!=0) { 
    $username=$bbuserinfo['username']; 
    print("<span class='welcome'><br><br><center>Welcome back, $username!&nbsp;&nbsp;&nbsp;&nbsp;<br><br><a href=\"http://www.salespractice.com/forums/\">Visit the Forums</a>&nbsp;&nbsp;&nbsp;&nbsp;</center>");
    } else {
    ?> 
    <form action='/forums/login.php' method='post' onsubmit='md5hash(vb_login_password,vb_login_md5password)'> 
    		<script type='text/javascript' src='/forums/clientscript/vbulletin_md5.js'></script> 
    		 <table cellpadding="1" cellspacing="3" border="0">
    		 <tr>
    		 <td class="login">User Name</td> 
    		 <td><input type='text' class='button' name='vb_login_username' id='navbar_username' size='10' accesskey='u' tabindex='1' value='' /></td>
    		 <td class="smallfont" colspan="2" nowrap="nowrap"><input type='checkbox' name='cookieuser' value='1' tabindex='3' id='cb_cookieuser_navbar' accesskey='c' checked='checked' /><span class='login'>Remember Me</span></td></tr>
    <tr><td class="login">Password</td>
    <td><input type='password' class='button' name='vb_login_password' size='13' accesskey='p' tabindex='2' /></td>
    <td><input name="submit" type='submit' class='button' accesskey='s' tabindex='4' title='Log In' value='Log In' />
    <span class="login">&nbsp;<a href="http://www.salespractice.com/forums/register.php?">Register</a></span></td></tr></table>
    		<input type='hidden' name='do' value='login' /> 
    		<input type='hidden' name='forceredirect' value='0' />			 
    		<input type='hidden' name='vb_login_md5password' /> 
    		</form>
    		<? 
    } 
    ?>
    PHP:
     
    ResaleBroker, Jun 21, 2005 IP
  4. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #4
    <input type='hidden' name='forceredirect' value='1' />

    IIRC
     
    noppid, Jun 21, 2005 IP
  5. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Thank you for the help. Changing the "0" to a "1" gave me the redirect screen however the end result is the same as with "O"... you are logged in but you don't get the "welcome member" message.

    What's frustrating is that the form works fine on a non-WP page. :(
     
    ResaleBroker, Jun 21, 2005 IP
  6. chachi

    chachi The other Jason

    Messages:
    1,600
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Jeff, I know this doesn't help, but I came across a tutorial one time while looking for information on the vbulletin forums. The tutorial was written by one of the mods there, so maybe you can track it down that way. If my memory serves me correctly, it was about building a static page that uses the VB backend. I will try and find it in a minute.
     
    chachi, Jun 21, 2005 IP
  7. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #7
    I've been able to accomplish my goal on a non-wordpress page but there appears to be a conflict with the wp_header and the VB code. :(
     
    ResaleBroker, Jun 21, 2005 IP
  8. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #8
    Post the template.
     
    noppid, Jun 21, 2005 IP
  9. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #9
    Thanks for taking a look. :)

    If I add the vBulletin code to the WordPress code I receive the following message: "Unable to add cookies, header already sent."

    CODE:
    <?php get_header(); ?>
    <?php 
    chdir("/home/sales/public_html/forums/"); 
    require('/home/sales/public_html/forums/global.php');
    chdir("./");
    ?>
    <body>
    <div id="container">
    <div id="content">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="content-table">
    <tr><td class="content-table" width="60%" valign="top">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h1><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Link: <?php the_title(); ?>"><?php the_title(); ?></a></h1>
    <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    <br />
    <fieldset id="sales-training">
    <div id="browse"><? include ('../include/article-permissions.inc'); ?></div>
    </fieldset>
    </div>
    <?php endwhile; else: ?>
    <p>Sorry, no posts matched your criteria.</p>
    <?php endif; ?>
    </td><td class="sidebar" width="40%" valign="top">
    <fieldset id="salestraining"><legend>Recent Community Posts</legend>
    <? include ('../include/article-sidebar.inc'); ?>
    </fieldset>
    </td></tr></table>
    <div id="header">
    <? include ('../include/article-header.inc'); ?>
    </div>
    <div id="footer"><? include ('../include/article-copyright.inc'); ?></div>
    </div></div><br />
    </body>
    </html>
    PHP:
     
    ResaleBroker, Jun 21, 2005 IP
  10. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #10
    Get rid of the include global.php for vbulletin. You don't need it to show the html form. That should fix ya up.
     
    noppid, Jun 21, 2005 IP
  11. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #11
    By removing the call to global.php users are allowed to login but instead of the "welcome user" message the login boxes remain which makes it appear that nothing happened after loggin in. :( Any ideas?
     
    ResaleBroker, Jun 21, 2005 IP
  12. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #12
    Show me your page, in PM if you prefer. Sounds like you have the welcome box too.
     
    noppid, Jun 21, 2005 IP
  13. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #13
    Here is the page.
     
    ResaleBroker, Jun 21, 2005 IP
  14. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #14
    try making these paths complete.

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

    I've done this before, but I can' find the damn file and I'm way tired.
     
    noppid, Jun 21, 2005 IP
  15. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #15
    I'll change the paths and then post the results tomorrow. Thank you very much for your time and efforts. :cool:
     
    ResaleBroker, Jun 21, 2005 IP
  16. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #16
    Unfortunately that didn't work. :(
     
    ResaleBroker, Jun 22, 2005 IP
  17. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #17
    When I did this last, it was stragight html, no trip through global. Trying to fix this like this is next to imopssible. We're spoon feeding each other.

    This is a 10 minute job IMO and we're banging our head on the wall.
     
    noppid, Jun 22, 2005 IP
  18. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #18
    I appreciate any help I can get so if there is anything I can do just let me know.

    Just to clarify, the script works for logging in. The challenge is that once logged in the "username" is not displayed on the WP page as it does on the non-WP page.

    After you login to the homepage you are greated with a welcome message. After you login to the WordPress page, instead of the welcome message you get the login boxes again.

    Again, if there is anything I can do just say the word. :)
     
    ResaleBroker, Jun 22, 2005 IP
  19. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #19
    Oh! See, I was chasing a redirect issue. No wonder I got nowhere!

    I think the issue will be that vBulletin uses template conditionals in their system to pull that off. You can get to the same variables going through global.php, so you'd need to duplicate that code in php around the welcome box and login box code.
     
    noppid, Jun 22, 2005 IP
  20. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #20
    Thanks for pointing me in the right direction. I'll see what I can do. ;)
     
    ResaleBroker, Jun 22, 2005 IP