Associate multiple email addresses with the same user account, so they can log in with either

If you create them programmatically, you could set it up so that all of the usernames are one type of email address (business or personal) and the WP email address field contains the other type. It’s not clear if this would fit your particular use case, but one other login possibility is to integrate single … Read more

ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?

New answer I now have a better understanding of the question thanks to OPs comment and have come up with the following. Not tested! global $wpdb; /** * @var string $field The flexible content field name. */ $field = ‘a_flexible_content_field’; /** * @var string $layout The flexible layout name. */ $layout=”layoutTwo”; /** * @var string … Read more

Solving a get_user_meta() problem in Multisite

The problem is that the idea of “the user of a specific subdirectory” doesn’t really exist natively in WP. There are sites (“subdirectories”), and there are users, and users can be associated with sites (through Roles and Capabilities), but there is no guarantee of a one-to-one correspondence. If you are running a network where users … Read more

editing usermeta when field is an array

This code is your problem: $s2_custom=get_user_meta($u->ID, ‘wp_s2member_custom_fields’); $real = $s2_custom[0]; $real[‘loomsong_del’]=’email’; update_user_meta($u->ID, ‘wp_s2member_custom_fields’,$real); get_user_meta returns an array of the meta values. Since in this case there’s only a single value with the array, you need to pass the single parameter to it. Try this: $s2_custom=get_user_meta($u->ID, ‘wp_s2member_custom_fields’, true); $s2_custom[‘loomsong_del’]=’email’; update_user_meta($u->ID, ‘wp_s2member_custom_fields’,$s2_custom); This won’t fix your already … Read more

get_the_author_meta not working

In the “homepage” code you posted, you have get_the_author_meta commented out. <?php /*?><img src=”https://wordpress.stackexchange.com/questions/77403/<?php echo esc_attr( get_the_author_meta(“author_pic_sidebar’, $user->ID ) ); ?>” alt=”” /><?php */?> That is why it doesn’t work. See that <php /*?> right at the beginning of the line?

How to add to a user_meta field (append)

Use get_user_meta(): $original = get_user_meta( $user->ID, ‘purchase_history’, TRUE ); echo $original . ‘ Pancake Breakfast 05/15/2005’; To update the value use update_user_meta(): update_user_meta( $user->ID, ‘purchase_history’, $original . ‘Pancake Breakfast 05/15/2005’ );

Countdown to date function?

You can use the following function to display it <?php function days_to_go(){ $datetime1 = new DateTime(‘2013-3-2’);//Pass resignation date as a parameter. $datetime2 = new DateTime(now); $interval = $datetime1->diff($datetime2); echo $interval->format(‘%a days to go’); } ?> For more information on date_diff function see this page.

Test if key is in user_meta array

First of all, I believe your syntax is incorrect. Should be: $group = ‘_mm_group_membership’; // key should be a string Secondly, did you try using $u->get? Here’s what the doc says: If fields is set to all_with_meta, it will return an array of WP_User objects. So yes, if you specified this parameter you should get … Read more