Skip to:
Content
Pages
Categories
Search
Top
Bottom

Users abandon the site after they login, seeing WordPress backend

Viewing 25 replies - 1 through 25 (of 40 total)
  • I can see that its going to be an issue also, sending them to backend when they login, people look at that, especially first timers, and go… “welp, thats interesting… outta here”


    life2000
    Participant

    @life2000

    All we need to do is to direct them to their profile page withing Buddypress site after they log in. Is there a way to modify the email messages that go out during and after activation process?

    This problem has burned a hole in my brain for the last 24 hours.

    HELP PLEASE!


    Scotm
    Participant

    @scotm

    I believe Andy is going to address this issue, but in the meantime I’ve found some success using the “Block Admin” plugin. This allows you to set a redirect URL when someone tries to access wp-admin. You also need to comment out a few of the Buddypress admin bar sub-menus to prevent users from accessing the backend.

    Works fine for me but I agree it’s an issue that should be addressed.

    Cheers

    There are workarounds for this, but the real issue is that this is the intended outcome for normal WP. Since it is the intended result for WP, it gets pulled into WPMU since it is synced off the WP development. Since BP works on WPMU, it gets the same result. See the pattern ;)

    That “block admin” plugin works well and if users login from the main site, it doesn’t direct them. Only when they hit wp-login.php will they get redirected to the dashboard. If you are a WPMUDEV.org premium subscriber, they have a plugin that changes this default behavior, so I would imagine there are other solutions out there as well.

    Thanks for insight. Scot M, where are you redirecting to? I was thinking to http:/yoursite.com/members


    Scotm
    Participant

    @scotm

    I redirect to the same /URL/members.


    life2000
    Participant

    @life2000

    Hi Scot:

    Thank you so much. Which sub-menus should I comment out from Buddypress admin bar?

    Also, I have uploaded the plug in “Block Admin”, but can’t find the settings related to this plugin anywhere in the dashboard.

    Seems like a tough day today. Thank you so much for your help.

    vida


    Scotm
    Participant

    @scotm

    There’s no settings in the admin panel but you can change the redirect URL within the plugin file, line 21 if I remember correctly.

    Go to /wp-content/mu-plugins/bp-core/bp-core-admin.php and comment out line 73 (My Account sub-menus) as well as 148-151 and 153. I’ve also commented out the “create a blog” call which is on line 165.

    You may find it only works on new blogs created after installing Block Admin.

    Cheers


    Burt Adsit
    Participant

    @burtadsit

    I found a little filter hook in wp-login.php that seemed just right for this. It is buried in that mass of stuff in that file on line 436 (wpmu 2.7).


    $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);


    So I built a little plugin that hooks this filter.


    function oci_login_redirect($redirect_to, $set_for, $user){
    $redirect_to = bp_core_get_userurl($user->ID);
    return $redirect_to;
    }
    add_filter('login_redirect', 'oci_login_redirect', 10, 3);


    Create a file with the above code and drop it into /mu-plugins. It sends the user to their profile after logging in. You can send them wherever you want them to go by changing $redirect_to.


    Burt Adsit
    Participant

    @burtadsit

    Well, here’s an even better idea. Don’t create a file called just anything. Call it bp-custom.php and put it in there. Drop that in /mu-plugins. I looked at the SVN log and as of rev 1012 if that file exists in /mu-plugins it gets run before anything else in bp.

    Cool. Thanks Andy!

    Now I know how to launch all my little tweaks. The official way.


    Anointed
    Participant

    @anointed

    thank you!

    Can I ask what the 10, and 3 refer to in the very last line of code?

    I am just now learning how to understand code that I am reading, and I think I grasp everything but that part.


    Burt Adsit
    Participant

    @burtadsit

    Howdy. The ’10’ is the priority of the filter (normal) and ‘3’ is the number of arguments the oci_login_redirect() function takes.

    https://codex.wordpress.org/Plugin_API#Filters

    If you take a look at the apply_filters() call that is in wp-login.php it sends along 3 params. The second param is not so obvious:

    isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''

    Read it as:

    ‘if the redirect_to is set to something then use that as the 2nd param and if it isn’t set then pass along nothing as the 2nd param’.

    Just in case we want to do something fancy in the filter that has to do with where the redirection was supposed to go in the first place.


    life2000
    Participant

    @life2000

    Hi Burt:

    So, I uploaded the latest version off the trunk: r1015 and all good. But when I throw in the above plugin, I get the exact line of the plugin code on top of the header on the site.

    When I try to login, it gives me many many lines such as below:

    Warning: Cannot modify header information – headers already sent by (output started at /home/cyrkabiz/public_html/cyrka.net/wp-content/mu-plugins/bp-custom.php:5) in /home/cyrkabiz/public_html/cyrka.net/wp-login.php on line 255

    Should I put the plugin in a folder or something?

    Thanks so much;

    vida


    Burt Adsit
    Participant

    @burtadsit

    You need to make it an actual executable php file by putting <?php at the top and ?> at the bottom of the file.


    Scotm
    Participant

    @scotm

    So this is a preferred way to avoid the wp-admin or wp-login page versus the Block Admin plugin, correct? This would mean users, including Admin, would have to login from the front end via the sidebar, for example?

    I’ll see if there is a filter I can use to stop this from happening.


    Burt Adsit
    Participant

    @burtadsit

    scotm, preferred way? I don’t know about that guy. It’s a solution to a specific problem. I don’t dev preferred solutions to bp. Not my job man. :)


    Phunky
    Participant

    @phunky

    You could extend on burtadsit plugin and check the users role/cap first and then redirect them accordingly.


    Scotm
    Participant

    @scotm

    burtadsit, i meant to say alternative way. sound right?


    Burt Adsit
    Participant

    @burtadsit

    Phunky, ya that $user param isn’t just a user id. It’s the massive wp user object.

    $user->all_about_this_person_and_then_some


    life2000
    Participant

    @life2000

    Burt:

    THANK YOU so much. It worked! I made the file executable, as you said, and it worked beautifully, directing me straight to the user’s profile page right after the lognin page.

    But please don’t go away yet. The outstanding thing now is the password. Seeing as though users will have no access to the back end to change the password, they may be stuck with WordPress’s assigned password. Is there a way to help them have their own selected password?

    This may be asking too much. But seeing as though we have Andy’s attention too, I hope we can do it and offer the users a great experience at the outset. I know once they get through the registration happily, they would be amazed by the power of this platform.

    Nonetheless, I am already happy with this progress.

    Thanks so much;

    vida


    Burt Adsit
    Participant

    @burtadsit

    Yep. If you disable the back end they won’t be able to change the password. You want to disable it completely? How are people going to write blog posts?

    Anyway, the password on signup is more than I have time for now. There is a premium plugin available on wpmudev.org http://premium.wpmudev.org/project/set-password-on-wordpress-mu-blog-creation that does what you want. I don’t know if it works with bp or not.


    life2000
    Participant

    @life2000

    Almost solved! Password not a problem.

    I just noticed that I can easily change the password using the “settings” on the profile page. It’s awesome!

    I won’t be giving them a blog yet. So that won’t be a problem.

    So, all set. All I have to do now is change the text on the last activation email sent to users. It looks rather unfriendly with the title: “dear user” and the signature “WordPress”.

    Other than that, it’s all cool.

    THANK YOU SO MUCH.


    Adam W. Warner
    Participant

    @awarner20

    There’s also a premium plugin that allows for login redirection, but it looks like you’ve already solved that;)

    http://premium.wpmudev.org/project/login-redirect


    Burt Adsit
    Participant

    @burtadsit

    Premium $ for that? It’s 5 lines of code.

    Probably lots of bells and whistles with the premium plugin.

    XMLRPC interface to your iphone. Plays a song. Washes the dishes. Babysits the kids. Detection routine for site admin ‘crankyness’ level.

Viewing 25 replies - 1 through 25 (of 40 total)
  • The topic ‘Users abandon the site after they login, seeing WordPress backend’ is closed to new replies.
Skip to toolbar