Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Commit

Permalink
Removes "Create user accounts?" admin setting - accounts are now alwa…
Browse files Browse the repository at this point in the history
…ys created

See chnm/thatcamp-org#69
  • Loading branch information
boonebgorges committed May 22, 2013
1 parent 815e96c commit 39b1698
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 34 deletions.
11 changes: 0 additions & 11 deletions thatcamp-registrations-admin.php
Expand Up @@ -320,7 +320,6 @@ function settings_display() {

$newOptions = array(
'open_registration' => $_POST['open_registration'],
'create_user_accounts' => $_POST['create_user_accounts'],
'pending_application_email' => $_POST['pending_application_email'],
'approved_application_email' => $_POST['approved_application_email'],
'rejected_application_email' => $_POST['rejected_application_email']
Expand Down Expand Up @@ -356,16 +355,6 @@ function settings_display() {
<p class="description"><?php _e('Before you open registration, create a page called (for instance) &#8220;Register&#8221; and type the shortcode &#x5b;thatcamp-registration&#x5d; on the page. When you open registrations, the registration form will be generated on that page. ', 'thatcamp-registrations'); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="create_user_accounts"><?php _e( 'Create user accounts after registering?', 'thatcamp-registrations' ) ?></label></th>
<td>
<select name="create_user_accounts">
<option value="1"<?php if($options['create_user_accounts'] == 1) { echo ' selected="selected"';} ?>><?php _e('Yes'); ?> </option>
<option value="0" <?php if($options['create_user_accounts'] == 0) { echo ' selected="selected"';} ?>><?php _e('No'); ?> </option>
</select>
<p class="description"><?php _e('If &#8220;Yes&#8221;, approving a registration will add the registrant to this site as a user with Author privileges. If &#8220;No&#8221, approving a registration will not add the registrant as a user to this site.', 'thatcamp-registrations'); ?></p>
</td>
</tr>

<tr>
<th scope="row"><label for="admin_notify_emails"><?php _e( 'Application notification addresses', 'thatcamp-registrations' ) ?></label></th>
Expand Down
30 changes: 7 additions & 23 deletions thatcamp-registrations-functions.php
Expand Up @@ -267,15 +267,13 @@ function thatcamp_registrations_process_registrations($ids = array(), $status) {
);

// Maybe create/associate WP accounts with the registration
if ( thatcamp_registrations_create_user_accounts() ) {
if ( $status == 'approved' ) {
foreach ($ids as $id) {
thatcamp_registrations_process_user($id);
}
} else if ( $status == 'rejected' ) {
foreach ( $ids as $id ) {
thatcamp_registrations_maybe_remove_wp_user( $id );
}
if ( $status == 'approved' ) {
foreach ($ids as $id) {
thatcamp_registrations_process_user($id);
}
} else if ( $status == 'rejected' ) {
foreach ( $ids as $id ) {
thatcamp_registrations_maybe_remove_wp_user( $id );
}
}

Expand Down Expand Up @@ -501,10 +499,6 @@ function thatcamp_registrations_options()
$options['open_registration'] = 0;
}

if ( empty( $options['create_user_accounts'] ) ) {
$options['create_user_accounts'] = 1;
}

// We do an isset check here, because we want to allow for null values
if ( ! isset( $options['admin_notify_emails'] ) ) {
$options['admin_notify_emails'] = array( get_option( 'admin_email' ) );
Expand Down Expand Up @@ -629,16 +623,6 @@ function thatcamp_registrations_existing_user_welcome_email( $user_id ) {
return false;
}

/**
* Checks the option to create user accounts upon registration approval.
*
* @return boolean
**/
function thatcamp_registrations_create_user_accounts()
{
return (bool) thatcamp_registrations_option('create_user_accounts');
}

/**
* Checks to see if user authentication is required.
*
Expand Down

0 comments on commit 39b1698

Please sign in to comment.