I put this within the elseif($_POST['follow'] === 'Connect'){
section
Just added this and am now waiting for my email to come through.. Fingers crossed:
$to = $profile_user->user_email;
$subject = 'Design4Health User Connection';
$body = 'Hi '.$profile_user->nice_name.',<br/><br>you have just been connected by '.$current_user->nice_name.' on Design4Health.<br/><br>Please log in to see your connections.<br/><br>If you would like this connection to be removed. Please contact [email protected] for further assistance.<br/><br>Kind Regards<br/><br>Design4Health' ;
$headers = array('Content-Type: text/html; charset=UTF-8','From: My Site Name <[email protected]>');
wp_mail( $to, $subject, $body, $headers );
You absolute genius!!!
Thank you so much for your help!
The bits inside the loop are not problematic. As they work elsewhere. It associates to a Memberpress form that has certain selections associated with logos (clients request). The issue is definitely within the foreach loop/meta query. But I can’t seem to find the solution.
Thanks John. I’ll take a look. I wasn’t sure if there was a way of doing a loop (as mentioned above), that would loop through ALL users and highlight those who have added you to their field.
That would then alert users to the fact that User A added you to their list.
Currently using this code, which displays nothing.
The user is returning User Objects. So not sure if this is just missing something to make it work right.
<div class="connectedtoyou usersloop teamloop" style="margin-top:40px!important;margin-bottom:40px!important;display:none!important;">
<hr>
<div class="users">
<h3 class="center centered">Users connected to you</h3>
<?php
$current_user = wp_get_current_user();
$connect_user = 'user_'.$current_user->ID;
$connect_field = get_field('user_follows');
$args = array(
'meta_key' => $connect_field,
'meta_value' => $connect_user,
);
$user_query = new WP_User_Query( $args );
if ( ! empty( $user_query ) ) { ?>
<div class="row isotope">
<?php foreach( $user_query as $user ): ?>
<div class="col fade-up item">
<div class="item-container"><a href="<?php echo get_author_posts_url( $user->id ); ?>" style="text-decoration:none!important;">
<?php if ('health' == get_user_meta($user->ID, 'mepr_select_ident', true)) { ?><img src="<?php echo get_home_url(); ?>/wp-content/uploads/2023/01/D4HGN_Logo_2.png" alt="Health">
<?php } elseif ('design' == get_user_meta($user->ID, 'mepr_select_ident', true)) { ?><img src="<?php echo get_home_url(); ?>/wp-content/uploads/2023/01/D4HGN_Logo_1.png" alt="Design">
<?php } elseif ('research' == get_user_meta($user->ID, 'mepr_select_ident', true)) { ?><img src="<?php echo get_home_url(); ?>/wp-content/uploads/2023/01/D4HGN_Logo_3.png" alt="Research">
<?php } elseif ('global' == get_user_meta($user->ID, 'mepr_select_ident', true)) { ?><img src="<?php echo get_home_url(); ?>/wp-content/uploads/2023/01/D4HGN_Logo_4.png" alt="Global">
<?php } elseif ('network' == get_user_meta($user->ID, 'mepr_select_ident', true)) { ?><img src="<?php echo get_home_url(); ?>/wp-content/uploads/2023/01/D4HGN_Logo_5.png" alt="Network">
<?php } else { ?>
<?php } ?>
<h4 class="darkgrey"><?php echo esc_html( $user->first_name ); ?> <?php echo esc_html( $user->last_name ); ?></h4>
</a></div>
</div>
<?php endforeach; ?>
</div>
<?php } else { ?>
<p>No users are connected to you. <a href="https://d4hgn.com/network/network-users/">Click here to see who's on the network</a>.</p>
<?php } wp_reset_postdata(); ?>
</div>
</div>
Users to users.
Essentially they are connecting to each other, and they want a way to have it so if User A is logged in and User B has added them as a connection that they know this by either an alert on their account page or as a list of people connected to them.
Thats the ideal situation.
That was it!! Thanks for that John.. I just utterly missed it!
Currently it displays both of the items at once, because it can’t show the “active” class only because they’re both displaying the active class.. Any help would be great!
Sorry, totally my fault.
I have uploaded a .zip file now 🙂
Blast… I will have to get in touch with the theme/plugin dev to work out the hook.
Thanks for your help.
Hi John,
Thats not a problem. The code is the closest i’ve managed to get.. any idea why it wouldn’t save on import?
This is the code i’ve been working with:
function update_price_cf( $value, $post_id, $field ) {
$emptyprice = get_post_meta( $post_id, 'test', true );
$importprice = get_post_meta( $post_id, '24-month-payment', true );
if ($emptyprice == '') {
$value = $importprice;
}
return $value;
}
add_filter('acf/update_value/name=test', 'update_price_cf', 10, 3);
It sort of works.. its doesn’t work when I import in the data. Though it did work when I did an update of the post.
Just thought that I would check to see if that helped at all? There was another file called parsecsv.lib.php which has more information on the CSV import.
Plus a couple of other files.
Found the associated file for the importer. I have attached it to this post 🙂 don’t know if this helps?
It’s part of the theme itself. I’ll have to find it tomorrow when I get back to my desktop.
The theme is a car listings theme.
I will find out the plugin tomorrow morning and put info on here about the import function (if I can find it) or just the Zip of the actual plugin itself, if that helps?
It’s using a listings plugin, which has its own import function.
If it helps I can create a username/password so that you can see the import.
Annoyingly it’s not using the standard xml import. It’s importing from a CSV.
Chris
Hi John,
Thanks for replying, essentially yes.
The import is happening and populating a non ACF field. And I want to take what is put into the field on import from that field and copy it to an ACF field.
Does that make sense?
Chris
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.