Hi BuddyDev (Brajesh)
I’ve been using BP Multi Network for a while and is doing very well!!! BUT…
HAVING ISSUE:
Recently I’m using the register form shortcode of Profile Builder Plugin to add new users from frontend but I noticed that new users created by this method are not registering in the “bp_mnetwork_users” table so their are not appearing in the buddypress comunitty of their respective sub site.*Same issue when adding new users by the WP-ERP plugin.
There is some way maybe a function or filter to make this two plugins can work together with BP Multi Network Plugin???
I’ll appreciatte some advice please.
Hi Rick,
Thank you for using the plugin.We use following actions to attach user to a network.
add_user_to_blog
or
wpmu_activate_user
If the plugin you are using the to register, adds a user to a sub site(they will most probably use add_user_to_blog()
It seems they are not doing it.
Please contact them and ask if they are compatible with Multisite(use multisite specific add user to blog or wpmu activate user).
They can add it and It will work.
Regards
Brajesh¡Many Thanks Brajesh…! You are the best.. you rock with your quickly responses and help.
I’ll will do contact these plugins developers.
IN CASE THE DEVELOPERS SAY THEY CANNOT MAKE THIS CHANGE… There is some way to make some kind of cron or manual function to add/activate users to the “xx_bp_mnetwork_users” table??? (I did test adding a user directly to the “xx_bp_mnetwork_users” table and seems working but I would like to find an automatic solution to run this task, just in case)
Some help or advice?
- This reply was modified 5 years, 7 months ago by RickHN.
Hi Rick,
Thank you for the kind words.My suggestion will be to not modify the mnetwork_table.
Instead, add user to proper blog using a script and they will be synchronized. I am not sure how will you decide which users should go to which blog. If there is any data to decide that, It will be easy.
Regards
BrajeshBrajesh… Thanks again for you kindly response.
It would help using the “get_blogs_of_user()” function of wordpress? To determine which blog the users should go?
I barely do “play” with PHP and WP Functions code and did some test with “get_blogs_of_user()” to get what blog te user belongs and it seems works getting the “userblog_id”.
This is the function:
function ofi_mostrar_blog_de_usuario(){ if ( is_user_logged_in() ) { // && is_user_member_of_blog() $user_id = get_current_user_id(); $user_blogs = get_blogs_of_user( $user_id ); echo '<h1>User '.$user_id.'\'s blogs:<ul>'; foreach ($user_blogs AS $user_blog) { echo '<li>'.$user_blog->userblog_id.'</li></h1>'; } $all_meta_for_user = array_map( function( $a ){ return $a[0]; }, get_user_meta( $user_id ) ); print_r( $all_meta_for_user ); } } add_action('wp_head', 'ofi_mostrar_blog_de_usuario');
Some advice or help to adapt this to an automatic or cron job function to sync users so appearing in their respective blog bp activity?
Or there are some way to hook the “get_blogs_of_user()” functions for any third party plugin that adding new users without it? (Maybe I’m saying nonsense here hehe)
Thanks for your patient Brajesh.
Hello…
Some help with previous messages?
There is some possibility to add an sync function to MultiNetwork Plugin? (in cases some plugins do not registering new users with “add_user_to_blog()” function?)
Could “get_blogs_of_user()” function be useful?
Thanks for reply
Hi Rick,
I am sorry, we have been unable to reply in time on forum due to office move and have been trying to resolve most issues last week.About your issue:- There is a solution if the users are being registered on sub sites and not on the main site. In order to add a user to a specific sub site, we need to know if they registered on it or not. If they are registering on the main site, we can not automate(if we do, all new users will be added to the main site).
If you are letting users register on sub sites(the registration form is on the sub site), then we may have an option. We can
user_register
and add user to the current sub site.
Regards
BrajeshHi Brajesh…
Please, you do not need to apologize, on the contrary, forgive me for bothering you so much about this matter.
Answering to your interrogant:
YES, the registration form is in the subsite, and all new users added by this form are listing well in the users list in their respective subsite admin dashboard.I imagine that some function can be added by the hook “user_register” as you suggest so the other plugins register methods can add new users to the currently blog and sync with BP-Multi-Nertwork plugin.
Could you give me some clue or better if is an example? 🙂
I’m very grateful for your time to reply my messages.
Many thanks Brajesh.
- This reply was modified 5 years, 7 months ago by RickHN.
Hi Rick,
Thank you.Please put this code in your bp-custom.php
/** * Add user as subscriber to current blog. * * @param int $user_id user id. */ function buddydev_custom_add_to_blog_on_register( $user_id ) { // add as a subscriber to current blog. add_user_to_blog( get_current_blog_id(), $user_id, 'subscriber' ); } add_action( 'user_register', 'buddydev_custom_add_to_blog_on_register' );
That will add a user to current blog on signup.
Bets Regards
Brajesh
You must be logged in to reply to this topic.