Store stripe info as user_meta

Sounds like the $amount variable is empty so it’s not saving. Echo it out to see what’s happening. Make sure the $payment_user_id is an actual WordPress user_id. Wrap your update_user_meta within the if statement. // If charge is successful, store in user meta if (isset($event) && $event->type == “charge.succeeded”) { $amount = $event->data->object->amount / 100; … Read more

Get all data form users and users metakey

WordPress provides a function get_users which display all the user detail and which field you want just pass in the ‘fields’ array. $users = get_users( array( ‘fields’ => array( ‘ID’,’user_login’, ‘user_email’) ) ); foreach ( $blogusers as $user ) { $user_work = get_user_meta( $user->ID, ‘user_work’, true); $user_street = get_user_meta( $user->ID, ‘user_street’, true); $user_state = get_user_meta( … Read more

Creating a button from data from Author meta

You just created an empty link, it has correct link but no inner text: echo ‘<a href=”‘ . esc_url( the_author_meta(‘snapchat_profile’)) . ‘”>Follow on Snapchat</a>’; And since you already stored the link in $snapchat_profile variable, no need to call the the_author_meta(‘snapchat_profile’) function once again (it will only reduce in a few bits of extra memory usage … Read more

Get meta key with value for user

Use get_user_meta() to get the meta data associated with the users in your loop: <?php $roles = array(‘autobuyer’); $users = array(); foreach ( $roles as $role ) { $args = array( ‘role’=>$role, ‘orderby’ => ‘registered’, ‘order’ => ‘ASC’, ‘search_columns’ => ‘nicename’, ‘number’=> 0, ‘date_query’ => array( ‘after’ => ‘October 14st, 2013’, ‘before’ => array( ‘year’ … Read more

Plugin MySQL SELECT custom data and filter on user meta

Without a proper SQL query in the question is not possible to write a proper query in the response, but following your pseudo-code approach: SELECT custom-data FROM custom-table LEFT JOIN wp_users ON custom_data.user_id = wp_users.ID LEFT JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id WHERE some-condition AND wp_usermeta.meta_key = ‘flag’ AND wp_usermeta.meta_value=”flagvalue” So basically, you need to … Read more

add_user_meta() vs update_user_meta()

You have already found out that using update_user_meta() if the meta field for the user does not exist, it will be added. ie update_user_meta() can do the task of add_user_meta() However, the difference between them is the return values update_user_meta() returns False if no change was made (if the new value was the same as … Read more