| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreFile |
| 3 |
/** |
| 4 |
* Pluggable functions within WordPress. |
| 5 |
* |
| 6 |
* Copyright: © 2009-2011 |
| 7 |
* {@link http://websharks-inc.com/ WebSharks, Inc.} |
| 8 |
* (coded in the USA) |
| 9 |
* |
| 10 |
* Released under the terms of the GNU General Public License. |
| 11 |
* You should have received a copy of the GNU General Public License, |
| 12 |
* along with this software. In the main directory, see: /licensing/ |
| 13 |
* If not, see: {@link http://www.gnu.org/licenses/}. |
| 14 |
* |
| 15 |
* @package s2Member |
| 16 |
* @since 110707 |
| 17 |
*/ |
| 18 |
if(!defined('WPINC')) // MUST have WordPress. |
| 19 |
exit('Do not access this file directly.'); |
| 20 |
|
| 21 |
if (!function_exists ('wp_new_user_notification')) |
| 22 |
{ |
| 23 |
/** |
| 24 |
* New User notifications. |
| 25 |
* |
| 26 |
* The arguments to this function are passed through the class method. |
| 27 |
* |
| 28 |
* @package s2Member |
| 29 |
* @since 110707 |
| 30 |
* |
| 31 |
* @return class Return-value of class method. |
| 32 |
*/ |
| 33 |
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_emails_enabled'] || $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password']) |
| 34 |
{ |
| 35 |
function wp_new_user_notification() |
| 36 |
{ |
| 37 |
$args = func_get_args(); // Function arguments. |
| 38 |
|
| 39 |
if (version_compare(get_bloginfo('version'), '4.3.1', '>=')) |
| 40 |
{ |
| 41 |
$_43_args = array(); // Initialize WP v4.3.1 args. |
| 42 |
|
| 43 |
$_43_args[0] = isset($args[0]) ? $args[0] : 0; |
| 44 |
// This is always a user ID. Still the same. |
| 45 |
|
| 46 |
$_43_args[1] = isset($args[3]) ? $args[3] : ''; |
| 47 |
// Our `wp_new_user_notification()` implementation supports a 4th arg: `$user_pass`. |
| 48 |
// Default; no passwords via email in WordPress v4.3+. |
| 49 |
|
| 50 |
if (!empty($args[2]) && $args[2] === 'both') |
| 51 |
$_43_args[2] = array('user', 'admin'); |
| 52 |
|
| 53 |
else if (!empty($args[2]) && is_string($args[2])) // Something else? |
| 54 |
$_43_args[2] = array($args[2]); // e.g., `user`, `admin`. |
| 55 |
|
| 56 |
else $_43_args[2] = array('admin'); // Default behavior. |
| 57 |
|
| 58 |
$args = $_43_args; // Use restructured arguments. |
| 59 |
} |
| 60 |
// Sucky WP v4.3 workaround. I was forced into doing this!! |
| 61 |
else if (version_compare(get_bloginfo('version'), '4.3', '>=')) |
| 62 |
{ |
| 63 |
$_43_args = array(); // Initialize WP v4.3 args. |
| 64 |
|
| 65 |
$_43_args[0] = isset($args[0]) ? $args[0] : 0; |
| 66 |
// This is always a user ID. Still the same. |
| 67 |
|
| 68 |
$_43_args[1] = isset($args[2]) ? $args[2] : ''; |
| 69 |
// Our `wp_new_user_notification()` implementation supports a 3rd arg: `$user_pass`. |
| 70 |
// Default; no passwords via email in WordPress v4.3+. |
| 71 |
|
| 72 |
if (!empty($args[1]) && $args[1] === 'both') |
| 73 |
$_43_args[2] = array('user', 'admin'); |
| 74 |
|
| 75 |
else if (!empty($args[1]) && is_string($args[1])) // Something else? |
| 76 |
$_43_args[2] = array($args[1]); // e.g., `user`, `admin`. |
| 77 |
|
| 78 |
else $_43_args[2] = array('admin'); // Default behavior. |
| 79 |
|
| 80 |
$args = $_43_args; // Use restructured arguments. |
| 81 |
} |
| 82 |
return call_user_func_array('c_ws_plugin__s2member_email_configs::new_user_notification', $args); |
| 83 |
} |
| 84 |
add_filter('wpmu_welcome_user_notification', 'c_ws_plugin__s2member_email_configs::new_user_notification', 10, 2); |
| 85 |
} |
| 86 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['pluggables']['wp_new_user_notification'] = true; |
| 87 |
} |
| 88 |
|