{"id":135,"date":"2009-07-06T20:25:18","date_gmt":"2009-07-06T19:25:18","guid":{"rendered":"http:\/\/www.k-braungardt.de\/blogkb\/?p=135"},"modified":"2012-05-30T07:19:46","modified_gmt":"2012-05-30T06:19:46","slug":"per-blog-registrations-on-wpmu-271","status":"publish","type":"post","link":"https:\/\/www.k-braungardt.de\/blogkb\/?p=135","title":{"rendered":"Per Blog Registrations on WPMU 2.7.1"},"content":{"rendered":"<p><strong>Problem: <\/strong><br \/>\nRegistration possible only for the Main Blog with Setting &#8222;User Accounts Registration only&#8220;.<br \/>\nRequired: Users can register for multiple Sub Blogs. <\/p>\n<p>Use Case: A Faculty member set up different blogs. Students were assigned to write posts<br \/>\non these blogs. They registered and had subscriber status for the Main Blog. Now they<br \/>\nwere manually added to the desired blog. With approximately 100 students there is a lot to<br \/>\ndo. So it would be nice to have students automatically sign up for a specific blog. <\/p>\n<p><strong>First solution<\/strong>:<br \/>\nWPMU Per-Blog Registrations Plugin by Nathan Kinkade:<br \/>\nhttp:\/\/code.creativecommons.org\/viewsvn\/wordpressmu\/trunk\/mu-<br \/>\nplugins\/per_blog_registrations\/perBlogRegistrations.php?view=log<br \/>\nThis did not work for us. Users still got redirected to the Main Blog with wp-signup.php. <\/p>\n<p><strong>Second solution:<\/strong><br \/>\nPrerequisite:<br \/>\nSub Blog Setting is &#8222;Users can Register&#8220;: 1 <\/p>\n<p>Changes in wp-login.php:<br \/>\n1) In the Main part in case &#8218;register&#8216; two lines should be commented out: wp_direct and<br \/>\nexit. These are the lines responsible for redirecting to wp-sign-up with the Main Blog.<br \/>\nIf the redirect does not take place, users can register with the Sub Blog.<br \/>\ncase &#8218;register&#8216; :<br \/>\n\/\/ WPMU doesn&#8217;t use this<br \/>\n\/\/wp_redirect( get_bloginfo(&#8218;wpurl&#8216;) . &#8218;\/wp-signup.php&#8216; );<br \/>\n\/\/exit;<br \/>\nWith these changes users can register only once for one Sub Blog. For another Sub Blog<br \/>\nthey would have to log in with a new account. To allow students to register with multiple<br \/>\nSub Blogs further changes have to be made in wp-login.php. <\/p>\n<p>2) For multiple Sub Blog Registration the function  &#8222;register_new_user&#8220; is supplemented<br \/>\nby the following request: If a user is already registered username and email both have to<br \/>\nbe existent. If they both exist, the user is added as a subscriber to the blog:<br \/>\nFollowing the line: $user_email = apply_filters( &#8218;user_registration_email&#8216;, $user_email );<br \/>\nthese lines are added: <\/p>\n<p>if( username_exists( $user_login ) &#038;&#038; email_exists( $user_email ) )<br \/>\n{<br \/>\n$userid = username_exists( $user_login );<br \/>\nadd_user_to_blog( $current_site->blog_id, $userid, &#8222;subscriber&#8220;);<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nThe closing bracket is placed after return $user_id; <\/p>\n<p>3. What does the user get? The user goes to register for the Sub Blog and fills in his or her<br \/>\nusername and email adress. With first time registering a password is sent to the person&#8217;s<br \/>\nemail adress. If already registered, there is no password sent. So it would be nice to read <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem: Registration possible only for the Main Blog with Setting &#8222;User Accounts Registration only&#8220;. Required: Users can register for multiple Sub Blogs. Use Case: A&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/www.k-braungardt.de\/blogkb\/?p=135\">Weiterlesen<span class=\"screen-reader-text\">Per Blog Registrations on WPMU 2.7.1<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[73,74,72],"class_list":["post-135","post","type-post","status-publish","format-standard","hentry","category-e-learning","tag-blog","tag-registration","tag-wpmu","entry"],"_links":{"self":[{"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=\/wp\/v2\/posts\/135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=135"}],"version-history":[{"count":4,"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":692,"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions\/692"}],"wp:attachment":[{"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.k-braungardt.de\/blogkb\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}