Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress Login from WordPress


  • AvatarX
    Member

    @avatarx

    Hi everyone, I’m a bbPress newbie and have recently installed it along side my WordPress blog and followed the basic integration steps in the docs here. My WP blog is the home of my site and I have a link to the forums similar to this site after customizing the themes for both. I’ve removed the login/registration links from WP (anyone can comment) and users can log in from the bbPress login form if they’re at the forums.

    What I’d like to have is that same bbPress login form show up in my WP page so that if users are logged in they get the welcome/view profile otherwise they can log in/register from anywhere on the site. I want all registration to happen through bbPress that way users aren’t confused by two login systems/profiles. I’ve been following alot of integration topics here and haven’t found one that answers this question for me so please let me know how this might be done or if it’s not a good idea for reasons I haven’t thought about.

    Also, I don’t know any PHP but I can code in other languages. I’m not familar with any functions in bbPress or WP for that matter so hopefully this isn’t that involved but I’m definitely interested in learning. Just thought I’d give some heads up. :)

    Thanks in advance!

Viewing 15 replies - 1 through 15 (of 15 total)
  • we solved this issue in a previous thread, just make a search :)

    Are your usertables integrated? If they are it shouldn’t matter what login form you use and your userdetails should be identical, a change in one system resulting in a change in the other. In that case you can simply but the WP login forms back and integrate cookies.

    If they are not integrated and you don’t want to do so, a solution could be to load bbPress when you load WP [edit: but again unless you're integrated you'll have function name collisions so that's not an option] and use the login_form() I believe it is template tag.

    Or you could just look at what the bbP output login form is like, copy the HTML into wordpress and let users use that. No reason why that shouldn’t work. :)

    ganzua, that’s not all that helpful.

    “ganzua, that’s not all that helpful.”

    Well, If undestood quite enough this quote;

    “What I’d like to have is that same bbPress login form show up in my WP page so that if users are logged in they get the welcome/view profile otherwise they can log in/register from anywhere on the site.”

    We solved this same thing here, ;

    http://bbpress.org/forums/topic/any-idea-to-integrate-wp-and-bb-login-forms?replies=24

    That may have been factually accurate, but telling him that it’s been solved and he should go search is not helpful. Linking him to a solution would be.


    AvatarX
    Member

    @avatarx

    Thanks for both your replies. I’d read that thread previously and my impression was that it is overly complex for what I’m trying to accomplish and was hoping for a much simpler way. I’d rather avoid having to “hack core files” as described and I want to be able to upgrade both WP and bbPress easily with changes only in my template files. I also don’t need the complex behavior of conditionally showing admin links, etc. since I just bookmark the admin page. And finally, as I mentioned, my PHP skills are non-existant at this point so not the kind of thing I am comfortable taking on right now.

    fel64, currently I have my user tables and cookies integrated. I installed bbPress within the WP directory to get the easy integration described in the docs since I’m still pretty new to both. So far that seems to work great. I like your suggestion of just grabbing the HTML code for the WP login and making it look like the bbPress login. That would solve the login part of it. However, then I would need some conditional code to display different things if the user is logged in or not, similar to what the bbPress login form does. It displays the welcome and profile link if logged in, or login form if not. For new user registration I’d have to send them to the bbPress registration page because I want them to fill out profile info not available in the WP registration form since it only asks for username/pw. Then I think it would be kind of weird that the user clicks register from the home WP page and gets taken to the forums after they register. Probably have to do some special handling there to see where they came from and send them to the right place.

    So…. hope you don’t mind the thinking outloud but after all that I’m wondering if it’s all worth the trouble given how unfamiliar I am with these systems. Maybe I’ll postpone this until future versions of bbPress make login integration much easier or there are plug-ins written for WP that can help. My initial thought was, why can’t I just call the login form code from bbPress from WP? Is this something that requires a deeper level of integration than what I have? I’m curious about this in general as it would be something I’d like to be able to do in the future.

    Thanks!

    It does indeed require a deeper level of integration. You want to load bb when you load wp, so open wp’s wp-config.php and add the following line:

    require_once('./bbpress/bb-load.php');

    where /bbpress/ should be the subdirectory of wordpress that bb is in. If that works you should now be able to call any bb function from wp.


    AvatarX
    Member

    @avatarx

    Thanks fel64, that did it, sort of… I inserted the line at the end of my wp-config.php file and that allows me to call the login_form() PHP function from bbPress from within WP. The page loads fine except I do get an error message at the bottom of my browser (using IE 7) that says, “Done, but with errors on page”. I think this means there’s a javascript error somewhere? No idea where to start looking for this. Any thoughts?

    Also, it doesn’t quite work as desired since when you do anything with the login form it redirects you to the forums which makes sense but not the behavior I want. I think I may forego any further modifications for now but I like the idea of the deeper integration between WP and bbPress. If I can figure out the error I may be able to dabble more later as I learn more PHP.

    Thanks!

    Can you link us to it?

    The login functions that logs you into bb redirect you to the forums. It may be possible to change that behaviour but I’m not immediately sure how – probably using an action or filter, possibly the action bb_user_login.


    AvatarX
    Member

    @avatarx

    I just downloaded Firefox w/Firebug and looking at the message it appears to be related to another plug-in I am using. Otherwise I think it works fine, but it’s looking like more customization than I want to do right now for those behaviors I was talking about. I think I’ll just stick with what I have, but thanks to both for your help! I’ll provide a link to my site once it’s live, right now it’s kind of a mess. ;)


    Detective
    Member

    @detective

    This is what i do in my sidebar (in WP and BB):

    <form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
    <label for="log">Usuario<br /><input type="text" name="log" id="log" value="" size="22" /></label>
    <label for="pwd">Password<br /><input type="password" name="pwd" id="pwd" size="22" /></label>
    <input type="submit" name="submit" value="Ingresar" class="button" />
    <label for="rememberme"><small><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Recordarme</small></label><br />
    <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
    </form>


    AvatarX
    Member

    @avatarx

    Hey Detective, thanks for the code snipet. I checked out your site and I see it on your sidebar in the forums but not on your main WP sidebar? BTW, nice looking site. :)


    Detective
    Member

    @detective

    Hi!

    I don’t use BBPress in that site, i’m installing it on another site, and there the code i posted works :)


    MaryJane
    Member

    @maryjane

    This is what i have for my wp login. I want my users to login/register from the wp side. So i have this snippet of code i gathered from various forum posts as well as some of it was in my current theme.

    It says Welcome guest when you arent logged in or registered and it gives the link to register. If your signed in or sign in it says Welcome username and shows the forum avatar you have set. Based on your user level it shows you different links for each thing you can do. Like make a post in WP or your profile and favorites in the forum.

    I have a redirect page setup that when you login from this form it just directs you back to the index page instead of going automatically to the dashboard as this confuses most people and the links are on there if your signed in to show you what you can do.

    ** I didnt write this i just gathered it up from various sources on the internet in different forum posts and edited it to suit my needs. Part of it was already wrote into the theme i bought for my wp. **

    pastebin url to it: http://pastebin.ca/651318

    The redirect part is a file i named redirect.php and placed in my wp main directory with a redirect link to the main page. You can see that bit here :

    http://pastebin.ca/651326

    If you have your bbpress intergrated well with wp you should be able to use the same form on your forum. That is what i use.

    If you’d be so kind as to take all that code out of your post and put it in http://pastebin.ca/ then link to it, that’d be nice. Also, bb doesn’t by default use bbCode. Code is delimited by ` backticks.


    MaryJane
    Member

    @maryjane

    Yea after i tried posting it in there a few times i figured that out. Will do boss! ^_^

Viewing 15 replies - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.