Support Forum
Hi
We are currently trying to map our users to certain groups in Simple:Press.
There are currently users of the blog but not members of the forums. We are using the "Members" plugin that enables us to have separate roles (supplementing the regular Subscriber, Editor etc roles with Student, Parent and Teacher). This part appears to be working perfectly. All the users (about 850) are either Administrators, Students, Teachers or Parents of the blog.
I now wish to map these blog users to our forum. Unfortunately when I try to run the "Map Users" tool it is not picking up anybody.
Now if a user logs in to the forum they are then put in the correct group - I just can't map them in those groups initially before they log in. I need to do this because I wish to split a few of the students in to class groups but cannot do this until they log in to the forum.
We are using Wordpress 3.4.1 and Simple:Press 5.1.2 under a multisite install. The forum is installed on a sub-blog (not the main one)
Please help!
Josh
wow. lots going on there.
so it sounds like the plugin you are using for membership is not firing the standard wp hooks for new user creation on multisite... so the forum does not know the user is created until the user's first visit... and we have backup logic in place to create the user on their first visit if we were never notified of their creation...
the only way we (SP) can know there is a new user is via hook... when wp create a new user, it fires a hook so plugins can act accordingly... it appears you members plugin is not firing this standard wp hook...
Can you go to the admin for this network site (not the main site) and create a test user from the wp add user interface? and see if it gets put in user group properly... guessing it will...
Visit Cruise Talk Central and Mr Papa's World
Haha yeah there is lots going on! It's a fairly complex system... I forgot to mention another plugin - Multisite User Managment. This is the plugin that adds the users to the forum blog.
What hook are you referring to? That plugin is using this code:
add_user_to_blog( $blog_id, $user_id, 'student' );
Is there other hooks that I should know about?
Edit: Yeah you were right I added a new user manually to the site and it created them fine in the forum.
that's not a hook... its a function call... and I dont think its where the member plugin is actually creating the user...
the multisite hooks for user creation that wp uses are:
wpmu_new_user wpmu_activate_user added_existing_user
or the standard wp hook for user creation is:
user_register
they are fired whether user registers or admin creates in admin panel...
If you know where its done in the plugin, you could just call our member create function (which is the callback function to the wp new user hooks):
function sp_create_member_data($userid)
Visit Cruise Talk Central and Mr Papa's World
ya know, something just clicked... forgot you said you were using this multisite user management plugin... so wonder if thats where non standard things are happening... could the user be getting created on a different network site or the main site? and then the management plugin is just 'copying' the user to the network site with the forum on it?? and hence we never get notified...
if so, wonder if there is a hook in the function you mentioned, add_user_to_blog(), that could be used to catch this other type condition... will check tomorrow...
Visit Cruise Talk Central and Mr Papa's World
ya know, that generally wont work... in your case, you dont have simple press running on the main blog so it wouldnt even catch the hooks that are used by those routines...
Visit Cruise Talk Central and Mr Papa's World
that should do it... but if simple press is not running on that site, the function wont run... you might have to switch to the blog simple press is on, then call the function... but try it and see...
Visit Cruise Talk Central and Mr Papa's World
Success!
I got it working by calling sp_create_member_data when adding the users to the blog. The only problem I had on Simple Press's side was that the line (137 ap-api-users.php):
$sql = 'INSERT INTO '.SFMEMBERS."
was not finding my forum blog - it was going to the main blog (wp_sfmembers). Changing it to:
$sql = 'INSERT INTO '.$wpdb->prefix."sfmembers
fixed it (wp_679_sfmembers).
I'm not sure if that was something I could have on my plugin side or if S:P is at fault. Anyway, it works...
Thanks for your help.
Josh
yeah, that's why I said you might have to switch to the blog simple press is on before calling the function... nice work!
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)