Dealing with login situations for various contact users
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 1 Dec 2015 17:15:30 +0000 (12:15 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 1 Dec 2015 17:15:30 +0000 (12:15 -0500)
glm-member-db-contacts.php

index 0a8cbea..139d6b3 100644 (file)
@@ -168,6 +168,12 @@ add_filter('glm-member-db-register-addon','glmMembersRegisterContacts', 10, 1);
  */
 require_once(GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/permissions.php');
 
+
+// If they are a restricted user, kick them back out
+if (current_user_can('glm_members_restricted_contact')) {
+    wp_logout();
+}
+
 /*
  * Add filter to redirect user to a particular destination on
  * login based on their roles.
@@ -184,11 +190,12 @@ function my_login_redirect( $redirect_to, $request, $user ) {
         foreach ($user->roles as $r) {
             if (substr($r,0,12) != 'glm_members_') {
                 // Go to normal destination for this user
-                return 'htt://www.gaslightmedia.com';
+                return $redirect_to();
             }
         }
 
         // If we get here, this is a pure contact user, start them at their profile
+
         return '/wp-admin/admin.php?page=glm-members-admin-menu-profile';
 
     }