Skip to:
Content
Pages
Categories
Search
Top
Bottom

Convert WP users to Buddypress users


  • Emineminero
    Participant

    @emineminero

    Hi, this is a known “issue” i have read every single topic here, i even run a script on my database.
    The thing is that in /members it only show the amount of users that had logged in after buddypress was installed. Before the Buddypress instalation i had 2000 users, now i have 4000+, so in /members the member count only counts those 4000 users.
    I run a script (created a mu-plugin) that goes user by user (foreach) and gave a last_activity time stamp. (Thats what i read in lots of forums, buddypress uses last_Activity to determine if the user is a buddypress or a WP user).
    Didnt work, the pre-buddypress users dont show up.
    I dont know what to do, in the front page of my site im saying that the site has over 6000 users and in /members it says that are only 4000. Im losing credibility.
    Other people suggested that selecting another filter like “Alphabetically” or “Last registered” should show all the users… Thats not my case.
    Wordpress version: 4.3
    Buddypress version: 2.4
    Im using a custom theme that uses this to show the amount of users:

    <div id="pag-top" class="pagination">
    
    		<div class="pag-count" id="member-dir-count-top">
    
    			<?php bp_members_pagination_count(); ?>
    
    		</div>
    
    		<div class="pagination-links" id="member-dir-pag-top">
    
    			<?php bp_members_pagination_links(); ?>
    
    		</div>
    
    	</div>
Viewing 6 replies - 1 through 6 (of 6 total)

  • shanebp
    Moderator

    @shanebp

    i even run a script on my database

    Show the script you ran. Use the code button.


    Emineminero
    Participant

    @emineminero

    $blogusers = get_users( 'blog_id=1&role=subscriber' );
    foreach (%bloguser as $user)
        {
           bp_update_user_last_activity($user->ID);
        }

    shanebp
    Moderator

    @shanebp

    Note this % in foreach (%bloguser as $user) and missing s
    It should be $blogusers


    Emineminero
    Participant

    @emineminero

    yes you are right, it was a typo here in the forum. In the plugin that i made was correctly writen 🙂


    shanebp
    Moderator

    @shanebp

    Are you sure those members are all subscribers?
    Remove your mu plugin.
    Try this in your theme/functions.php or plugins/bp-custom.php
    Remember to remove it when done.

    function mie_add_last_activity() {
    
      $subscribers =  get_users( 'fields=ID&role=subscriber' );
      
       foreach ( $subscribers as $user_id ) {
            bp_update_user_last_activity( $user_id, bp_core_current_time() );
       }
    
    }
    add_action('bp_init', 'mie_add_last_activity' );

    Emineminero
    Participant

    @emineminero

    I love you 😀
    It worked!!!!!!!!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Convert WP users to Buddypress users’ is closed to new replies.
Skip to toolbar