Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Show Profile of users before they login the first time

Viewing 3 replies - 1 through 3 (of 3 total)
  • Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    >Buddypress is waiting for the first login of each user

    At which point it will add a last_activity timestamp.
    The easiest solution is to add those timestamps for everyone via a script.
    Put this code in your bp-custom.php file, then open your site in a browser.
    Then remove the code – or it will update the timestamp on every page load.

    
    function daten_add_last_activity() {
        global $wpdb;
        foreach ( $wpdb->get_col( "SELECT ID FROM $wpdb->users" ) as $user_id ) {
            bp_update_user_last_activity( $user_id, bp_core_current_time() );
        }
    }
    add_action('bp_init', 'daten_add_last_activity' );
    Profile photo of Datenfresser123
    Datenfresser123
    Participant

    @datenfresser123

    Wow, thank you very very much. It works fantastic! Thanks.

    Beauty of forums are their archives, the question has arisen a few times:
    https://buddypress.org/support/topic/how-to-activate-existing-wp-users-as-bp-members-effectively/

    I needed a solution myself a few years back to activate imported users so ran a function up and uploaded to gist:
    https://github.com/hnla/force-show-bp-users

    Just updated it to reflect BP 2.0 changes to last activity to use ‘bp_update_user_last_activity()’ – it takes a slightly different approach in running only as admin and requiring that user runs the script by passing a get variable on the url ?action=force-active just to ensure script wasn’t run by accident or repeatedly also it checks and runs on a user id only if that user has no existing entry as I had existing users, I also didn’t want them all to have same time stamp so added in a delay on each iteration of the loop so each had a unique timestamp and just to allow breathing space between updates if loop particularly long.

    Updates to script are untested at this time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Show Profile of users before they login the first time’ is closed to new replies.
Skip to toolbar