Jump to content

If a number have same number get_avatar


PTW

Recommended Posts

This is working code that gets the data from a field that registered users have to fill out in their profiles in wordpress:

<?php
$field = xprofile_get_field_data(2, $user_id);
echo '<span class="wisfb_carNumber">' . $field . '<span>';
?>

This is the code that generates data from a Excel-file:

<?php $data = wp_excel_cms_get("EXCEL-DOCUMENT"); ?>

<?php foreach($data as $entry): ?>

<?php echo $entry[1]; ?>

<?php endforeach; ?>

Now I want to do this:

If the number witch is generated in:

<?php echo $entry[1]; ?>

is the same number as in the users:

$field = xprofile_get_field_data(2, $user_id);

get this users avatar:

echo get_avatar();

Does anyone have an idea on how to do this?

Link to comment
Share on other sites

 

Perhaps

if ($entry[1] == $field)  {
     echo get_avatar();
}

 

 

Ok, tried that but got no result if I just use that. But this gave me a clue on the way. In you code you wrote $field but I want to get the specific field $field = xprofile_get_field_data(2, $user_id); Like I wrote above.

 

So something like this: (even if this not work yet)

 

 

<?php 


if ($entry[1] == $field = xprofile_get_field_data(2, $user_id))  {
     echo get_avatar();
}


?>
Edited by PTW
Link to comment
Share on other sites

This code is now generating the default image but doesn't get the image I'm trying to get.

 

<?php  
if ($entry[1] == $field = xprofile_get_field_data(2, $user_id));  {
     echo get_avatar($field);
} 
?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.