Multiple Accounts or via the Settings link next to the plugin on the Manage Plugins page) is also provided to allow only certain email addresses the ability to have multiple accounts (such as if you only want admins to have that ability). You may also specify a limit to the number of accounts an email address can have. The settings page for the plugin also provides a table listing all user accounts, grouped by the email address (see screenshot). Compatible with WordPress 2.6+, 2.7+, 2.8+. =>> Read the accompanying readme.txt file for more information. Also, visit the plugin's homepage =>> for more information and the latest updates Installation: 1. Download the file http://coffee2code.com/wp-plugins/allow-multiple-accounts.zip and unzip it into your /wp-content/plugins/ directory. 2. Activate the plugin through the 'Plugins' admin menu in WordPress 3. Optionally go to the Users -> Multiple Accounts admin settings page (which you can also get to via the Settings link next to the plugin on the Manage Plugins page) and customize the settings. */ /* Copyright (c) 2008-2009 by Scott Reilly (aka coffee2code) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ if ( !class_exists('AllowMultipleAccounts') ) : class AllowMultipleAccounts { var $admin_options_name = 'c2c_allow_multiple_accounts'; var $nonce_field = 'update-allow_multiple_accounts'; var $show_admin = true; // Change this to false if you don't want the plugin's admin page shown. var $config = array(); var $options = array(); // Don't use this directly var $allow_multiple_accounts = false; // Used internally; not a setting! var $exceeded_limit = false; function AllowMultipleAccounts() { $this->config = array( 'allow_for_everyone' => array('input' => 'checkbox', 'default' => true, 'label' => __('Allow multiple accounts for everyone?', 'allow-multiple-accounts'), 'help' => __('If not checked, only the emails listed below can have multiple accounts.', 'allow-multiple-accounts')), 'account_limit' => array('input' => 'text', 'default' => '', 'label' => __('Account limit', 'allow-multiple-accounts'), 'help' => __('The maximum number of accounts that can be associated with a single email address. Leave blank to indicate no limit.', 'allow-multiple-accounts')), 'emails' => array('input' => 'inline_textarea', 'datatype' => 'array', 'default' => '', 'input_attributes' => 'style="width:98%;" rows="6"', 'label' => __('Multi-account emails', 'allow-multiple-accounts'), 'help' => __('If the checkbox above is unchecked, then only the emails listed here will be allowed to have multiple accounts. Define one per line.', 'allow-multiple-accounts')) ); add_action('init', array(&$this, 'load_textdomain')); add_action('admin_menu', array(&$this, 'admin_menu')); add_action('register_post', array(&$this, 'register_post'), 1, 3); add_filter('registration_errors', array(&$this, 'registration_errors'), 1); add_action('user_profile_update_errors', array(&$this, 'user_profile_update_errors'), 1, 3); } function install() { $this->options = $this->get_options(); update_option($this->admin_options_name, $this->options); } function admin_menu() { static $plugin_basename; if ( $this->show_admin ) { global $wp_version; if ( current_user_can('manage_options') ) { $plugin_basename = plugin_basename(__FILE__); if ( version_compare( $wp_version, '2.6.999', '>' ) ) add_filter( 'plugin_action_links_' . $plugin_basename, array(&$this, 'plugin_action_links') ); add_users_page(__('Multiple Accounts', 'allow-multiple-accounts'), __('Multiple Accounts', 'allow-multiple-accounts'), 9, $plugin_basename, array(&$this, 'options_page')); } } } function plugin_action_links( $action_links ) { static $plugin_basename; if ( !$plugin_basename ) $plugin_basename = plugin_basename(__FILE__); $settings_link = '' . __('Settings', 'allow-multiple-accounts') . ''; array_unshift( $action_links, $settings_link ); return $action_links; } function load_textdomain() { load_plugin_textdomain( 'allow-multiple-accounts', false, basename(dirname(__FILE__)) ); } function get_options() { if ( !empty($this->options) ) return $this->options; // Derive options from the config $options = array(); foreach (array_keys($this->config) as $opt) { $options[$opt] = $this->config[$opt]['default']; } $existing_options = get_option($this->admin_options_name); if ( !empty($existing_options) ) { foreach ($existing_options as $key => $value) $options[$key] = $value; } $this->options = $options; return $options; } function options_page() { static $plugin_basename; if ( !$plugin_basename ) $plugin_basename = plugin_basename(__FILE__); $options = $this->get_options(); // See if user has submitted form if ( isset($_POST['submitted']) ) { check_admin_referer($this->nonce_field); foreach (array_keys($options) AS $opt) { $options[$opt] = htmlspecialchars(stripslashes($_POST[$opt])); $input = $this->config[$opt]['input']; if (($input == 'checkbox') && !$options[$opt]) $options[$opt] = 0; if ($this->config[$opt]['datatype'] == 'array') { if ($input == 'text') $options[$opt] = explode(',', str_replace(array(', ', ' ', ','), ',', $options[$opt])); else $options[$opt] = array_map('trim', explode("\n", trim($options[$opt]))); } elseif ($this->config[$opt]['datatype'] == 'hash') { if ( !empty($options[$opt]) ) { $new_values = array(); foreach (explode("\n", $options[$opt]) AS $line) { list($shortcut, $text) = array_map('trim', explode("=>", $line, 2)); if (!empty($shortcut)) $new_values[str_replace('\\', '', $shortcut)] = str_replace('\\', '', $text); } $options[$opt] = $new_values; } } } // Remember to put all the other options into the array or they'll get lost! update_option($this->admin_options_name, $options); echo "
" . __('Settings saved', 'allow-multiple-accounts') . '
' . __('Allow multiple user accounts to be created from the same email address.', 'allow-multiple-accounts') . '
'; echo '' . __('By default, WordPress only allows a single user account to be assigned to specific email address. This plugin removes that restriction. An admin settings page (under Users → Multiple Accounts) is also provided to allow only certain email addresses the ability to have multiple accounts. You may also specify a limit to the number of accounts an email address can have.', 'allow-multiple-accounts') . '
'; echo '' . __('View a list of user accounts grouped by email address.', 'allow-multiple-accounts') . '
'; echo '| ' . __('Username', 'allow-multiple-accounts') . ' | ' . '' . __('Name', 'allow-multiple-accounts') . ' | ' . '' . __('E-mail', 'allow-multiple-accounts') . ' | ' . '' . __('Role', 'allow-multiple-accounts') . ' | ' . '' . __('Posts', 'allow-multiple-accounts') . ' | '; echo <<|
|---|---|---|---|---|---|
| '; printf(__ngettext('%s — %d account', '%s — %d accounts', $count, 'allow-multiple-accounts'), $email, $count); echo ' | |||||