|
@@ 879-910 (lines=32) @@
|
| 876 |
|
|
| 877 |
|
$user_id = wp_insert_user( $content ); |
| 878 |
|
|
| 879 |
|
if ( is_wp_error( $user_id ) ) { |
| 880 |
|
$success = false; |
| 881 |
|
$errors = $user_id; |
| 882 |
|
} else { |
| 883 |
|
$success = true; |
| 884 |
|
$errors = array(); |
| 885 |
|
foreach ( $params as $key => $value ) { |
| 886 |
|
$method = $value['method_modify']; |
| 887 |
|
// we need to provide a way for passing the values in a custom order here |
| 888 |
|
$meta_id = $method( $user_id, $key, $value['value'] ); |
| 889 |
|
if ( false === $meta_id ) { |
| 890 |
|
$success = false; |
| 891 |
|
$errors[] = array( |
| 892 |
|
'message' => sprintf( |
| 893 |
|
// translators: %1$s is a method name. |
| 894 |
|
esc_html__( 'Tried to upsert meta with method %1$s.', 'object-sync-for-salesforce' ), |
| 895 |
|
esc_html( $method ) |
| 896 |
|
), |
| 897 |
|
'key' => $key, |
| 898 |
|
'value' => $value, |
| 899 |
|
); |
| 900 |
|
} |
| 901 |
|
} |
| 902 |
|
|
| 903 |
|
// Developers can use this hook to set any other user data - permissions, etc. |
| 904 |
|
do_action( $this->option_prefix . 'set_more_user_data', $user_id, $params, 'create' ); |
| 905 |
|
|
| 906 |
|
// Send notification of new user. |
| 907 |
|
// todo: Figure out what permissions ought to get notifications for this and make sure it works the right way. |
| 908 |
|
wp_new_user_notification( $user_id, null, 'both' ); |
| 909 |
|
|
| 910 |
|
} |
| 911 |
|
} else { |
| 912 |
|
$user_id = username_exists( $username ); |
| 913 |
|
} // End if(). |
|
@@ 2194-2220 (lines=27) @@
|
| 2191 |
|
|
| 2192 |
|
$comment_id = wp_new_comment( $content ); |
| 2193 |
|
|
| 2194 |
|
if ( is_wp_error( $comment_id ) ) { |
| 2195 |
|
$success = false; |
| 2196 |
|
$errors = $comment_id; |
| 2197 |
|
} else { |
| 2198 |
|
$success = true; |
| 2199 |
|
$errors = array(); |
| 2200 |
|
foreach ( $params as $key => $value ) { |
| 2201 |
|
$method = $value['method_modify']; |
| 2202 |
|
$meta_id = $method( $comment_id, $key, $value['value'] ); |
| 2203 |
|
if ( false === $meta_id ) { |
| 2204 |
|
$success = false; |
| 2205 |
|
$errors[] = array( |
| 2206 |
|
'message' => sprintf( |
| 2207 |
|
// translators: %1$s is a method name. |
| 2208 |
|
esc_html__( 'Tried to add meta with method %1$s.', 'object-sync-for-salesforce' ), |
| 2209 |
|
esc_html( $method ) |
| 2210 |
|
), |
| 2211 |
|
'key' => $key, |
| 2212 |
|
'value' => $value, |
| 2213 |
|
); |
| 2214 |
|
} |
| 2215 |
|
} |
| 2216 |
|
|
| 2217 |
|
// Developers can use this hook to set any other comment data. |
| 2218 |
|
do_action( $this->option_prefix . 'set_more_comment_data', $comment_id, $params, 'create' ); |
| 2219 |
|
|
| 2220 |
|
} |
| 2221 |
|
|
| 2222 |
|
if ( is_wp_error( $comment_id ) ) { |
| 2223 |
|
$success = false; |