Helping you Build Your Own Social Network!

Faster, better and easier!

Display Avatars of Members with a Blank X-Profile Field...

(10 posts) (2 voices)

Tags:


  1. Hi Brajesh, I hope you're well?

    I need some help please with some code that I'd like to adapt for my site. The code below shows the last 5 avatars of members who have joined my site. Kind of like a gallery that gets displayed when a member logs in. This all works just fine.

    <h3>Latest Members</h3>
    
    <div style="width:635px; height:127px; border:solid;">
    <?php if ( bp_has_members( 'type=newest&max=5' ) )  : ?>
    <?php while ( bp_members() ) : bp_the_member(); ?>
    <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar('type=full&width=125&height=125') ?></a>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>
    <div class="clear"></div>

    What I would like to achieve is for our Site Admins to be able to see the avatars of ALL members who have a nothing in their 'About Me' x-profile field and have been registered for 2 days. This is so the Site Admins can delete the profiles of members who have not provided enough information on their profiles

    Can you help?

    All the best
    Rob

    Posted 6 months ago #
  2. Can anybody, please help me here?

    All I really need to be able to do is show all members on a page who have not completed their 'About Me' section on their profile.

    Anybody?

    Thanks
    Rob.

    Posted 6 months ago #
  3. Hi Rob,
    As far as I understand, It is easy to find the members who have filled something in a field. I will look today about the empty fields and let you know.

    Posted 6 months ago #
  4. Hi Brajesh, great I really appreciate that, thanks

    The idea is that I can give site admins access to a page where the usernames/profiles/avatars of members who have not completed their 'About Me' section get shown.

    This is so that they can delete incomplete profiles and tidy the site up.

    Thanks for your response
    Rob

    Posted 6 months ago #
  5. Sorry to chase you Brajesh, but any luck with this yet?

    Thanks
    Rob

    Posted 6 months ago #
  6. Brajesh,

    Any news on this please?

    All I need to do is show the Avatars of members who have not completed their 'About Me' X Profile field.

    This is driving me crazy, as everything I try doesn't work.

    Would really appreciate your input here?

    Thanks in advance
    Rob

    Posted 6 months ago #
  7. Rob,
    I have got a solution which finds all the members who have not field a field(It could be any field). I haven't been able to use the member loop(as the double loop conflicts sometime).

    I will be posting the code for the lopping today.

    Posted 6 months ago #
  8. Brajesh do you have the code please?

    Posted 5 months ago #
  9. Hi Rob,
    sorry for the delay.

    Here is the code

    <?php
    
    function bpdev_get_users_having_no_data($field_name){
        global $bp,$wpdb;
        $field_id=xprofile_get_field_id_from_name($field_name);
    
        if(empty($field_id))
            return false;
    
        $query="SELECT ID FROM {$wpdb->users} WHERE ID NOT IN (SELECT user_id FROM {$bp->profile->table_name_data} WHERE field_id=%d )";
    
        $users=$wpdb->get_col($wpdb->prepare($query,$field_id));
    
        if(!empty($users))
        $users=join(",",$users);
    
      return $users;
    }
    
    ?>
    
    <?php $users=bpdev_get_users_having_no_data('About');?>
    <h3>Latest Members</h3>
    <div style="width:635px; height:127px; border:solid;">
    
    <?php if ( bp_has_members( array('include'=>$users ) ))  : ?>
    <?php while ( bp_members() ) : bp_the_member(); ?>
    <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar('type=full&width=125&height=125') ?></a>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>
    <div class="clear"></div>
    Posted 5 months ago #
  10. Brajesh, thank you so much, that works!

    Is it possible to also add to this a condition which states that the member should be Non-Active for at least 2 Days before their profile gets displayed for not having their About Me profile field completed?

    Thanks Brajesh

    Rob.

    Posted 5 months ago #

Reply

You must log in to post.