Activating existing users
I have been running a blog on wp-single, with around 300 registered users.
I recently installed buddypress. While things are working fine for new users who register, the old users cannot use the features. When they login and click on profile, activity, etc. they are just redirected to the home page.
How can I activate the old users on buddypress?
Any help would be much appreciated
thanks very much
Visit these addresses:
If they are working, then your buddypress install is ok, it’s just a matter of where your buddybar links are going. Hover over your buddybar links and see where they would be heading. That might give you some clues of what’s going wrong.
I’m having a similar problem and I think it is tied to the fact that my installation is in a subfolder with my index.php on the root. I’ve noticed that the call bp->root_domain is built into all the adminbar links. If this is pulling my install location rather than my registered address, that would explain the problem. If that is the issue, I don’t know what to do about it besides hardwiring those links manually. I’m sure one of these code gurus would have a simple workaround.
Hi Matt – thanks for your response. My installation is in a sub-folder as well, so maybe thats causing the issue.
Can anyone help with a simple solution to this problem?
I’m seeing the same behavior where only new members are being added to BuddyPress. I don’t think it has anything to do with where things are installed. I don’t think BuddyPress attempts to add “old” WordPress-only users. You’ll also notice that past blog posts and comments, etc. aren’t shown in your BuddyPress activity stream. However, if you go into an “old” blog post and simply hit update, it gets added to the stream.
What we need is a utility that can be run that will load all the existing WP users into BP. I’d also love to see one that will load up the BP activity stream with WP blog posts and comments as well, but that’s probably asking for too much.
I did find a BuddyPress plugin that talks about being able to import users into BP. However, its not what we are looking for. It is designed to import a list of users that you cut-and-paste into a text box on the plugin. I checked the code and it will only work with WPMU and it will also (re)create whatever users you import into WP as well causing duplicates. https://wordpress.org/extend/plugins/user-import-for-buddypress-all-fields/
I’m going to dig around in the BP core to see how it goes about keeping BP and WP users in sync and see how hard it would be to write a program or plugin that would simply trigger BP to add all the existing WP users that aren’t already in BP.
Ok, here’s where I’m at so far. I found out what BP uses to determine if a WP user is a BP user. There is NOT a separate table for BP users. A WP user is considered a BP user if that user has performed ANY “activity”. The BP Members page displays ONLY users that have done something in BP.
For example, when a new user registers, an activity is created saying that user registered. The standard WP user meta table (wp_usermeta) gets a record added for that User ID called “last_activity” and the meta value is the current date and time. Once a user has a last_activity record, then they are displayed in the BP Member directory. You’ll notice that in the Member directory it shows the total users, which should be your total number of WP users, but it also says “Viewing member 1 to x (of x active members”.
I have verified this by manually adding a record to the user meta table for one of my users that registered before I was running BP. That person now shows in the BP member directory.
Now I also see code in BP that attempts to update (or create if not found) the user’s last_activity meta record every 5 minutes while they are logged in. This is so that BP can show how long ago a particular user was “active” for various pages and widgets. I tested this by logging in as another WP user (non-BP user) and it added the record and now displays that person in the list. It also seems to have added that user’s full name in the BP custom profile field table (wp_bp_xprofile_data).
So without doing ANYTHING, our BP member directory will grow as users log in to our site. This probably isn’t a bad thing because if there are users that registered a long time ago for some reason and don’t plan on ever coming back, why list them in the directory?
However, I may still go ahead and try to figure out the best way to programatically add records for all the WP users. My site is new and since I only have 221 users, I’d like to have them added to BP, if for no other reason than for better testing of the plugin before I roll it out. I currently have BP activated, but have hidden all the menus so user’s don’t really know how to get to any of it. My site is at http://xtremelysocial.com if you want to check it out. Just go directly to a BP URL, such as http://xtremelysocial.com/activity/. I’m jacking around with adding BP support to my highly customized WP theme right now so if the formatting looks whacky, that’s why.
I’ll post an update if I work something out programatically to add all the WP users to the BP member directory.
Tim – we must be on similar wavelengths. I was just thinking about this problem yesterday and I wrote the following: http://teleogistic.net/code/buddypress/bp-import-blog-activity/. I assume that, because this creates activity items for all members who have ever posted/commented on the site, it will do the work of adding those members to the directory as well. (Still doesn’t do anything for members who have never contributed, probably.) Hope it helps.
I just noticed the same thing, I’m on 2.9.2 single WP installation and BP. All my current WP users do not show up.
I also noted that the “last_activity” is was making they show up in BP. I’m thinking of just adding that key and a value to all my users manually (58) to get this working.
Anyone see any problem with this?
The default view for the member directory is “active members”. This will only show users who have logged in since you activated BuddyPress, and are therefore considered active (last_activity meta is present). If you change the ordering to something else, the members will show.
@andy, thanks for reply. For me it doesn’t seem to work. Just to let you know. I SQL imported my users from a production server to an development server so all users can be seen in WP admin area. If I in BP under members it sais in the heading
All members (58)
Viewing member 1 to 3 (of 3 active members)
If I change from “Last active” to “Newest registered” I get
Viewing member 1 to 20 (of 58 members)
which looks correct (and a navigation 1,2,3 etc)
…but if I change to “Alpabetical” I get
Viewing member 1 to 3 (of 3 members)
If I add the “last_activity” key to the user they also show up, bug or something strange with my installation?
To revive this discussion: I am curious if anyone has further light to shed on this. I think I see where the listing in the members -> recent activity comes from (xprofile_data) but where does the “members all” come from – direct from the WP_users table?
Now – the issue I have with this, is I have Buddypress in a sub-blog: http://www.mysite.com/community/ that I give selective access to certain users registered for http://www.mysite.com . I was hoping that when I made them a memeber of the Multi-Site subsite /community/ they would have access to Buddypress (and only then) — and I sure don’t want wp-users that are not part of the “community” listed in Buddypress.
Anyone figure out a way to “activate” all wordpress users so they show up on Buddypress right away?
I would also be interested in any development in this area.
On this same topic…..In the members directory in BP 1.5 user are displayed based on more criteria then mentioned by the discussion above.
User A (ID: 21) is showing up in the members directory but does NOT appear in the buddypress activity tables
$sql2 = “SELECT *
FROM wp_bp_activity activity
WHERE activity.user_id = $iUserID”;
OR the user_meta table
$sql3 = “SELECT *
FROM wp_usermeta UM
WHERE UM.user_id = $iUserID
AND UM.meta_key LIKE ‘last_activity'”;
Any thoughts on what’s making these members appear in the directory?
Altough User A (ID:21) does show up in the table “wp_bp_xprofile_data”
It would be great if there was some help in bp_has_members
To reference these orphaned users with a state…. like “inactive”
That’s seems to be it… regardless of BP activity or “last activity” the table wp_bp_xprofile_data is the lowest common denominator of who is displayed in the members directory.
$sql4 = “SELECT *
FROM wp_bp_xprofile_data XP
WHERE XP.user_id = $iUserID”;
Anyone happen to know if does exists some MySql query how to activate all “not recently active” members at once? I would like to see them all in BP Members directory.
Two plugins which look current and could help you https://wordpress.org/extend/plugins/activate-users-in-buddypress/ and https://wordpress.org/extend/plugins/wp-approve-user/
As usual, the following disclaimer applies: backup DB and files before activating plugin
Thanks @mercime but this is not a problem what I have asked, I know how to activate future users (WP – approve users plugin I don’t need) but I don’t know how to activate WP already registered users who succesfully registered their account but never did any activity in buddypress part , that’s why I can’t see them in buddypress directory , I have about 990 members registered who never posted any post , who never made any buddypress activity , only registered via gravity forms plugin – register user addon or registered via register page , that’s why I can’t see them in members directory where I have only 400 members, i would like to see them there all, but I don’t want to activate them one by one , so I search for some solution how to (maybe with the help of some query change some value in MySql table to get them there all),
“Activate users in Buddypress” plugin shows me all 990 users as already activated , some of them without BP activity and some of them without LAST ACTIVITY, there’s nothing to do, no button to change anything , this plugin will not help me to show them in members directory , there must be a simple query which will do it in batch for all of them, practicaly MEMBERS DIRECTORY it shows me only members with LAST ACTIVITY record , so simple query which will change that LAST ACTIVITY record will certainly help.
Is any clue about to fix that? I have 938 users, a lot of comments, and Buddypress dont show them.
What a situation…
i maybe talking way above my head here but I’m wondering something about your request aren’t you saying that you want to create activity (registering commenting whatever) which never actually happened prior buddypress being installed? and if it wasn’t a comment how would you derive a time to associate with the activity? unless it was comment (or something else with a time stamp) you would be creating something from nothing no?
adding a row in the database to usermeta ‘last_activity’, ‘with date’ in the database shows the user profile as theyve become ‘active users’, I need 1000 users activitated, anybody any dea how could do this as a batch?
ok I managed to do this using the buddypress import members plugin http://www.youngtechleads.com/buddypress-members-import/ (17$) and adding the field “last_activity” with a value of i.e. “2013-09-21 22:06:14” (could be any date I’m sure)
Good plugin for importing users in general!
Got a solution to this, just run this query on your wordpress database.
insert into wp_usermeta select null,ID, “last_activity”,”2013-12-12 08:24:52″ from wp_users
You will need to set the time and date to something you want but keep it in the right order.
HI, could anyone tell me how and where exactly should i paste the code above? Ideally how the final line should look like and where to paste it. i’ve been struggling with this issue for a while, found many posts with some apparently working solutions but the instructions are not clear to me at all. i am new to this and have no idea where to start with. many thanks!!!
There is no need to do a direct insert to the database.
Use the provided function instead:
bp_update_user_last_activity( $user_id );
It will create a last_activity entry for that user with the current time on your server.
So the user will then be ‘active’.
You can use the function in a loop to batch process users.
- The topic ‘Activating existing users’ is closed to new replies.