Answers.Body: <p>You're running into the effects of <a href="https://github.com/civicrm/civicrm-core/blob/bee660d8fdf9168d4cfeb71d89474c77979c7d73/CRM/Utils/System/WordPress.php#L609-L613" rel="nofollow noreferrer">this code</a> which automatically logs the user in. Unfortunately there's no way to override this code at the moment - except to override the class file itself by putting an edited copy in your custom PHP folder <a href="https://books.google.co.uk/books?id=KKjWDQAAQBAJ&amp;pg=PA532&amp;lpg=PA532&amp;dq=civicrm+override+core+files&amp;source=bl&amp;ots=FcUMrSyWc1&amp;sig=ACfU3U1YTVRAgeFXFQ7Lbs-hqTaCPlSRRg&amp;hl=en&amp;sa=X&amp;ved=2ahUKEwjfvdSNnITjAhWzVBUIHXwhBXwQ6AEwB3oECAgQAQ#v=onepage&amp;q=civicrm%20override%20core%20files&amp;f=false" rel="nofollow noreferrer">like this</a> and remove those lines.</p>
  
  <p>A couple of alternative approaches are to:</p>
  
  <ul>
  <li>Use BuddyPress to create the signup form for your website and let <a href="https://wordpress.org/plugins/civicrm-wp-profile-sync/" rel="nofollow noreferrer">CiviCRM WordPress Profile Sync</a> handle the creation of the CiviCRM Contact (optionally using <a href="https://wordpress.org/plugins/bp-xprofile-wp-user-sync/" rel="nofollow noreferrer">BP XProfile WordPress User Sync</a> as well if needed).</li>
  <li>Use a Contribution Page (if your site has Memberships) and let <a href="https://wordpress.org/plugins/civicrm-wp-member-sync/" rel="nofollow noreferrer">CiviCRM WordPress Member Sync</a> create the WordPress user.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-25T08:43:30.223Z
Answers.LastActivityDate: 2019-06-25T08:43:30.223Z
Answers.UserDisplayName: Christian Wach
Answers.Body: <p>Thanks a lot guys. You got me on the right way and I looked for a wordpress solution instead of a civi one.
  I just added the following bits of code to my function.php file (in the child theme) to get disconnected and immediately redirected to a specific page (otherwise I was getting a civicrm error telling me I had no access to the page it was redirecting me to) :</p>
  
  <pre><code>/**
   * WordPress function to prevent autologin
   */
  function user_autologout(){
              wp_logout();         
          }
  add_action('user_register','user_autologout');
  
  /**
   * WordPress function for redirecting users on logout. If user comes from registration page, they are directed to a page telling them that their membership request is pending. 
   */
  
  
  function auto_redirect_after_logout(){
      if (strpos($_SERVER['HTTP_REFERER'], 'inscription') !== false){
      wp_redirect( home_url().'/pending_registration/' );
      exit(); 
      }
      else{
      wp_redirect( home_url() );
      exit();
      }
  }
  add_action('wp_logout','auto_redirect_after_logout');
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-25T19:38:33.990Z
Answers.LastActivityDate: 2019-06-25T19:38:33.990Z
Answers.UserDisplayName: Tuto
Answers.Body: <p>CiviCRM relies on CMS(i.e WP) settings when creating users. By default WP doesn't provide any such settings so you may need to install some plugin which needs admin approval for newly created user. Probably something like <a href="https://wordpress.org/plugins/new-user-approve/" rel="nofollow noreferrer">User Approve</a> plugin.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-25T19:42:55.683Z
Answers.Text: Thanks, actually I am using this plugin but the user gets an error message telling him he/she has no access to the page when he/she registers.
  "We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled)"
Answers.UserDisplayName: Tuto
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-22T12:29:04.727Z
Answers.LastActivityDate: 2019-06-22T12:29:04.727Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>When people register on my wordpress website using a civicrm profile, they get logged in automatically. As I first need an Administrator to approve the user, I would like users not to be logged in after registration is complete.</p>
  
  <p>Is there a parameter I have missed or would I need to use a filter or whatever ?</p>
  
Tags: <wordpress><registration><logging>
Title: Prevent automatic login after registration
ThreadText: # Prevent automatic login after registration
  
  (Asked by: username_0 on 2019-06-22)
  
  When people register on my wordpress website using a civicrm profile, they get logged in automatically. As I first need an Administrator to approve the user, I would like users not to be logged in after registration is complete.
  
  Is there a parameter I have missed or would I need to use a filter or whatever ?
  
  **Tags:** wordpress, registration, logging
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2019-06-25. Score: 3
  
  You're running into the effects of [this code](https://github.com/civicrm/civicrm-core/blob/bee660d8fdf9168d4cfeb71d89474c77979c7d73/CRM/Utils/System/WordPress.php#L609-L613) which automatically logs the user in. Unfortunately there's no way to override this code at the moment - except to override the class file itself by putting an edited copy in your custom PHP folder [like this](https://books.google.co.uk/books?id=KKjWDQAAQBAJ&pg=PA532&lpg=PA532&dq=civicrm+override+core+files&source=bl&ots=FcUMrSyWc1&sig=ACfU3U1YTVRAgeFXFQ7Lbs-hqTaCPlSRRg&hl=en&sa=X&ved=2ahUKEwjfvdSNnITjAhWzVBUIHXwhBXwQ6AEwB3oECAgQAQ#v=onepage&q=civicrm%20override%20core%20files&f=false) and remove those lines.
  
  A couple of alternative approaches are to:
  
  * Use BuddyPress to create the signup form for your website and let [CiviCRM WordPress Profile Sync](https://wordpress.org/plugins/civicrm-wp-profile-sync/) handle the creation of the CiviCRM Contact (optionally using [BP XProfile WordPress User Sync](https://wordpress.org/plugins/bp-xprofile-wp-user-sync/) as well if needed).
  * Use a Contribution Page (if your site has Memberships) and let [CiviCRM WordPress Member Sync](https://wordpress.org/plugins/civicrm-wp-member-sync/) create the WordPress user.
  
  
  ---
  
  ### Answer by username_0 on 2019-06-25. Score: 3
  
  Thanks a lot guys. You got me on the right way and I looked for a wordpress solution instead of a civi one.
  I just added the following bits of code to my function.php file (in the child theme) to get disconnected and immediately redirected to a specific page (otherwise I was getting a civicrm error telling me I had no access to the page it was redirecting me to) :
  /**
   * WordPress function to prevent autologin
   */
  function user_autologout(){
              wp_logout();         
          }
  add_action('user_register','user_autologout');
  
  /**
   * WordPress function for redirecting users on logout. If user comes from registration page, they are directed to a page telling them that their membership request is pending. 
   */
  
  
  function auto_redirect_after_logout(){
      if (strpos($_SERVER['HTTP_REFERER'], 'inscription') !== false){
      wp_redirect( home_url().'/pending_registration/' );
      exit(); 
      }
      else{
      wp_redirect( home_url() );
      exit();
      }
  }
  add_action('wp_logout','auto_redirect_after_logout');
  
  
  ---
  
  ### Answer by username_2 on 2019-06-22. Score: 2
  
  CiviCRM relies on CMS(i.e WP) settings when creating users. By default WP doesn't provide any such settings so you may need to install some plugin which needs admin approval for newly created user. Probably something like [User Approve](https://wordpress.org/plugins/new-user-approve/) plugin.
  
  > **Comments:**
  > **username_0**: Thanks, actually I am using this plugin but the user gets an error message telling him he/she has no access to the page when he/she registers. "We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled)"  
  
  ---
  
  