How to select meta key in custom database query
How to select meta key in custom database query
How to select meta key in custom database query
The problem is that you’re using get_current_user_id();. There’s two reasons this is incorrect: The user being created is not necessarily the current user. For example, if an admin creates the user manually. user_register runs immediately after the user is created, but before the user is logged in. So when user_register runs for somebody registering on … Read more
To get the group count, use groups_get_user_groups. Find it in: buddypress\bp-groups\bp-groups-functions.php In the members loop, the member id is provided via: bp_member_user_id() You will need to check the member-loop template to find out how to hook into the loop. Or overload that template in your child theme and add a do_action wherever you want it. … Read more
generate PDF from member information
How to remove the url format from the WEBSITE field in the user registry?
I managed to come up with the answer 😀 Thanks to @Jos function ht1_change_avatar($args, $id_or_email) { $gender = get_user_meta($id_or_email, ‘user_gender’, true); if($gender==’Male’){ $myavatar=”http://localhost:81/matrimony/wp-content/uploads/2020/04/groom.png”; }else{ $myavatar=”http://localhost:81/matrimony/wp-content/uploads/2020/04/bride.png”; } $args[‘url’] = $myavatar; return $args; } add_filter(‘get_avatar_data’, ‘ht1_change_avatar’, 100, 2);
// User Settings Errors add_filter( ‘user_profile_update_errors’, ‘my_plugin_user_settings_errors’ ); function my_plugin_user_settings_errors( $errors ) { $user_level = intval( $_POST[ ‘my-plugin-user-level’ ] ); if ( ! is_int( $user_level ) || $user_level < 0 || $user_level > 50 ) { $errors->add( ‘my-plugin-invalid-admin-level’, ‘<strong>ERROR:</strong> User Level must be between 0 and 50.’ ); } return $errors; }
Try this: function assignuserid($user_id) { $user_meta = get_userdata($user_id); $user_roles = $user_meta->roles; if (in_array(“subscriber”, $user_roles)){ global $wpdb; $latestid=$wpdb->get_var(“SELECT meta_value from $wpdb->usermeta where meta_key=’member_id’ order by meta_value DESC limit 1;”); update_user_meta( $user_id, ‘member_id’, $latestid+1 ); } } add_action( ‘user_register’, ‘assignuserid’);
Move Non-WordPress users table to WordPress database
This works: $WhoIsUser = get_users( array( ‘meta_key’ => ‘deviceid’, ‘meta_value’ => ‘45545’ ) ); This returns the whole row for that user from the users table. If you print_r it out like so: echo ‘<pre>’ echo print_r($WhoIsUser, TRUE); echo ‘</pre>’ you get: Array ( [0] => WP_User Object ( [data] => stdClass Object ( [ID] … Read more