Skip to:
Content
Pages
Categories
Search
Top
Bottom

Edit the bbPress login widget


  • Jake Hall
    Participant

    @geekserve

    Hi guys,

    the way bbPress outputs the login page bugs me, a lot. What I am trying to do is add a login box to my layout, when I did – I found it added a list and a horrible fieldset around the whole thing. This doesn’t work with my design at all.

    So, on with my quest to change this, I found there is no template readily available to just change. Really? So, it seems all I can do is hack away at the core code, which will all be reverted once a new version comes around.

    Does anyone have any suggestions for this?

Viewing 25 replies - 1 through 25 (of 49 total)

  • Robin W
    Moderator

    @robin-w

    It bugs me as well.

    Two solutions I have documented

    Layout and functionality – Examples you can use

    Layout and functionality – Examples you can use

    You can also copy the core file into your functions file, hack it and rename it. There are several places it needs renaming, and if you would like to post your working solution, I’ll happily make a functions file version, as long as I can use it publicly


    Ismail
    Participant

    @elhardoum

    I wanted to do that too.. but unfortunately I couldn’t find a better answer so I had to edit the widgets file under includes/common/widgets.php ( my forum ) .


    Robkk
    Moderator

    @robkk

    the way bbPress outputs the login page bugs me, a lot. What I am trying to do is add a login box to my layout, when I did – I found it added a list and a horrible fieldset around the whole thing. This doesn’t work with my design at all.

    are you using the shortcode [bbp-login] ??

    you should use that shortcode if not.

    more shortcodes supplied with bbPress that you can use.

    https://codex.bbpress.org/shortcodes/

    I found there is no template readily available to just change. Really?

    yes there is its called form-user-login.php

    So, it seems all I can do is hack away at the core code, which will all be reverted once a new version comes around.

    dont do that


    Robin W
    Moderator

    @robin-w

    If you want to alter the widget, then you can rename it and put it as an additional widget in your functions file.

    You will need to rename it in several places.

    If you want to work on the core version and get it working, then if you want to post a revised core version (and any associated css) here, then I’ll quite happily work out the rename areas so you can then post it in your functions file – as long as your version is freely available for others (and me) to use.


    supremor
    Participant

    @supremor

    any suggestions, my log in widget does not look right.

    Log in


    Robin W
    Moderator

    @robin-w

    @supremor

    how do you want it to look?


    supremor
    Participant

    @supremor


    Robkk
    Moderator

    @robkk

    @supremor

    post a link to your site

    a little CSS could fix up the input box awkwardness and also help put labels on top.


    supremor
    Participant

    @supremor

    I fixed the look of it on desktop but it looks off on mobile. Needs spacing.

    http://www.carfanaticsforum.com/forums/


    Robkk
    Moderator

    @robkk

    you can see it comes back to normal on very small sizes close to 200 maybe settings a max width for the login form would do the job.

    try something close to this , edit if you want.

    .widget.bbp_widget_login .bbp-login-form {
    	max-width: 270px;
    }

    supremor
    Participant

    @supremor

    Where do I place the code?


    supremor
    Participant

    @supremor

    I added it to the style.css file. But on here it still looks the same:

    carfanaticsforum.com/login

    For mobile.


    Robkk
    Moderator

    @robkk

    do this instead since you want it for all of the bbPress login forms.

    .bbp-login-form {
    	max-width: 270px;
    }

    and you could put the CSS in many places

    a custom css plugin
    jetpacks css module
    your child themes stylesheet
    the bbpress.css stylesheet that should be copied to your child theme in a bbpress folder


    supremor
    Participant

    @supremor

    Thank you. Worked like a charm.


    supremor
    Participant

    @supremor

    I have another question. I’m trying to add the log in and log out code into functions but I get the following error:

    Parse error: syntax error, unexpected ‘Logout’ (T_STRING) in /home/carfan6/public_html/wp-content/themes/sparkle-child/functions.php on line 33


    Robin W
    Moderator

    @robin-w

    can you post lines 30-34 please


    supremor
    Participant

    @supremor


    supremor
    Participant

    @supremor

    All the code can be viewed there.


    Robin W
    Moderator

    @robin-w

    try changing ‘logout’ to “logout”


    supremor
    Participant

    @supremor

    I did but it ended up looking like this:

    https://www.flickr.com/gp/carfanatics/9m4f13


    Doug Smith
    Participant

    @douglsmith

    Another thing you might try is one of the many login widgets in the WordPress plugin repository. It doesn’t have to be specific to bbPress to work. For example, here’s a tabbed login widget that looks pretty nice.


    Robin W
    Moderator

    @robin-w

    Try the following

    //adds login/logout to menu
    //filter to add login/logout to menu
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_login_link' );
    function my_nav_menu_login_link($menu) {
        //uncomment the next line if you only want login on bbpress pages
        //if(is_bbpress()) {
        if (is_user_logged_in()) {
            //set the $url on the next line to the page you want users to go back to when they logout
            $url = 'http://www.mysite.com/forums' ;
            $url2=wp_logout_url($url) ;
            $loginlink = '<li><a title="Logout" href="'.$url2.'">Logout</a></li>';
            }
        else {
            $current_user = wp_get_current_user();
            $user=$current_user->user_login ;
            //set $page on the next line = the permalink for your login page
            $page='login' ;
            $loginlink = '<li><a href="/'.$page.'/">Login</a></li>';
                    }
        //uncomment out the next lines if you only want login on bbpress pages
        //      }
        //  else {
        //  $loginlink="" ;
        //      }
            $menu = $menu . $loginlink;
            return $menu;
    }

    supremor
    Participant

    @supremor

    Is that for me?


    supremor
    Participant

    @supremor

    can you help me fix the look of the registration page? – buttons.

    FireFox

    Chrome


    Robin W
    Moderator

    @robin-w

    can you help me fix the look of the registration page? – buttons.

    only if you can tell me what you would like changed !

Viewing 25 replies - 1 through 25 (of 49 total)
  • You must be logged in to reply to this topic.
Skip to toolbar