Skip to:
Content
Pages
Categories
Search
Top
Bottom

Replace WP profile edit with BP profile edit

  • @peterverkooijen

    Participant

    Is there already a plugin that replaces WP profile edit (wp-admin/profile.php) with BP profile edit? Or auto-forwards with zero second delay to a custom BP profile/password/email edit page?

    What would be the hook for such a plugin?

    Users end up on WP profile edit after getting a new password and other cases. The first thing they see is the Admin Color Scheme picker, obviously super important.

    Then they see all those profile fields that don’t synch with xprofile at all, so they’ll waste their time filling them out.

    And Jabber / Google Talk! Does anyone actually use that?

    The only thing that you really need from that page is the new password thingy, all the way at the bottom…

Viewing 12 replies - 1 through 12 (of 12 total)
  • @djpaul

    Keymaster

    No plugins like this for BP (atm?)

    @peterverkooijen

    Participant

    Well, someone better write it!

    That’ll be me I’m afraid…

    I’ll look into it. I’ve added a css class=”hideinshame” to all the crap in user-edit.php as a temporary hack, but I’ll need a cleaner, more permanent solution.

    @djpaul

    Keymaster

    I think your best bet is to redirect non-admin users away from /wp-admin/ URLs.

    I’ll dig up a hook for you when I get home in a little while.

    @djpaul

    Keymaster

    http://buddypress.pastebin.com/fd73915e

    That is not tested & is intended as a starting point. I think it does what you want.

    @peterverkooijen

    Participant

    Thanks so much Paul Dixon!

    That looks like a good start. I need to spend some time on my day job, but will test/finish this as soon as possible…

    @peterverkooijen

    Participant

    Following DJPaul’s example, this works great as a starting piont:

    function useraccount_redirect() {
    if ( !is_site_admin() && strpos( strtolower( $_SERVER['REQUEST_URI'] ), '/wp-admin/profile.php' ) !== false ) {
    bp_core_redirect( site_url() );
    }
    if ( !is_site_admin() && strpos( strtolower( $_SERVER['REQUEST_URI'] ), '/wp-login.php' ) !== false ) {
    bp_core_redirect( site_url() );
    }
    }
    add_action( 'plugins_loaded', 'useraccount_redirect', 11 );

    Instead of site_url it should redirect to customized copies of wp-login.php and profile.php, so first I need to figure out the syntax for that – I’ll do some searches… – and then I need to decide how and where to create those custom pages.

    Is there a way to include a custom page in a plugin folder. I can create a regular wp page in my template, but it would be nicer is it came with the plugin.

    I found this example for creating an admin page in a plugin:

    function bot_menu() {
    global $wpdb;
    include 'bot-admin.php';
    }

    function bot_admin_actions() {
    add_options_page("Bot Counter", "Bot Counter", 1,
    "Bot-Counter", "bot_menu");
    }

    add_action('admin_menu', 'bot_admin_actions');

    I need a regular page. Would that be similar? Not really sure what’s going on here…

    EDIT 2: OK, I’m not gonna bother with that at this point. I’ll first create a memberlogin.php and account.php as regular wp custom pages in my template.

    More later…

    @peterverkooijen

    Participant

    I’ve copied all code from wp-login.php to a custom wp page in my template called memberlogin.php at mywebsite.com/login. I had to make this edit to make the login form show up at that address:

    require( '././wp-load.php' );

    Unfortunately, the form is broken, so there must be other addresses in the file that require editing…

    EDIT 1: There’s an obvious culprit:

    <form name="lostpasswordform" id="lostpasswordform" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" method="post">

    Replaced all instances of ‘wp-login.php’ with ‘login’. Will all the code work without the php?

    Yes! Logging in via this form works.

    Unfortunately logging out does NOT work… :-(

    When I try /login?action=logout directly in the browser address bar I get this:

    You are attempting to log out of Your Site

    Do you really want to log out?

    After confirming the message bar says ‘failure noticed’ and I’m redirected to the homepage, still logged-in.

    Apparently those ?actions don’t get taken along with the redirect. The redirect is just a blunt redirect to the /login and there it ends. :-(

    @peterverkooijen

    Participant

    This is going nowhere. I’ll just hack core file; replace wp-login.php and wp-admin/profile.php with copies on login.php and account/profile.php (?) and then search/replace all links.

    I f***ing hate WordPress registration/member management!

    @johnjamesjacoby

    Keymaster

    You could make a custom login page with BP trunk like…

    define('BP_LOGIN_SLUG', 'login');
    function bp_show_login_page() {
    global $bp, $current_blog;

    if ( $bp->current_component == BP_LOGIN_SLUG && $bp->current_action == '' ) {
    bp_core_load_template( 'registration/login', true );
    }
    }
    add_action( 'wp', 'bp_show_login_page', 2 );

    Then put a template file named “login.php” in your frameworks registration folder and steal some code from the buddypress login form to help with getting started…

    There’s a few examples online on how to redirect the WordPress login page with .htaccess. Could give that a shot too?

    @peterverkooijen

    Participant

    DJPaul had already given me similar code – very much appreciated!

    The problem with redirects is that they ignore ?action=lostpassword etc., so you’d have to code around that. It becomes a huge mess – at least for me, since I have only a vague idea what I’m doing. Redirect is a dead end.

    Or will bp_core_load_template take care of those actions?

    I’ve now simply put my header/footer etc. in wp-login.php, without renaming. That file looks like an ancient relic. Automattic should restructure login/signup etc., split forms from php and bring it into the template structure.

    I’ve already spent way too much time on this. Quik and dirty solution will have to do for now. Need to get back to my day job…

    @gerikg

    Participant

    @peterverkooijen

    Participant

    Yes, I already use wp-hide-dashboard. It’s a partial solution.

    Users still get the pushy wp-login every now and then, which is a problem because it also has a link to an ancient register/signup form that clashes with Buddypress.

    wp-admin/profile.php also is not whacked by wp-hide-dashboard.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Replace WP profile edit with BP profile edit’ is closed to new replies.
Skip to toolbar