Forum Replies Created
-
Cool @henrywright-1 that’s got it. I found that showposts query, just wasn’t implementing it correctly. I owe you a pint (or 4).
OK it works really really well – except, it brings in not just the most recent, but 3 recent posts, can I limit the number?
Oh it’s actually THAT simple? Thanks so much, I’m enjoying learning from you guys 🙂
@henrywright-1 that works!
I need to show the featured image, and link to the profile, so I added the following, but it’s just pasting the image URL, how do I add img src to that and the link to the post?
<?php $user_id = bp_get_member_user_id(); $query = new WP_Query( 'author=' . $user_id ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); //display title the_title(); //display content the_content(); //featured image the_field('featuredimage'); } } //reset for next member wp_reset_postdata(); ?>Is there a way to do this? Thanks.
Thanks @mercime – however, I’m already successfully showing users posts on their profile – see below. I’m doing this using posts-on-profile but it’s quite out of date:

What I can’t do, is show the most recent post for each user on the members list (on the members home page) – note the placeholder image on the right for each member:

Hope someone can help!
Sorry to spam, but totally stuck on this, any ideas?
BP Xtra Signup worked well, although it’s 2 years out of date, it seems fine!
You’re right @henrywright-1 – just needed to upload the avatars again and it worked 🙂
Hi there
I added this in, and it does get the avatar back but it doesn’t solve the problem. My original code returns the same stretched pixelated avatar, I really need to try and get the large version. See screenshot (mine on top, yours below)

Ah so you think this can’t work as it stands @henrywright-1 ?
Perfect!

Thanks SO much.
Hi there
In the page template test I used your code exactly, within the profile.php file.
In the text widget I use the following (all of which work except Specialist Sectors):
`<div class=”<?php echo get_post_meta(get_the_id(), ‘Account Type’, true); ?>”>
“>
<?php if ( $sectors = bp_get_profile_field_data( ‘field=Specialist Sectors’ ) ) { ?>
<?php foreach ( $sectors as $sector ) { ?>
<?php echo $sector; ?>
<?php } ?>
<?php } ?>
“><h2 class=”profileHeader”> <?php echo get_the_author(); ?></h2>
<h2 class=”profileAccount”><?php echo get_post_meta(get_the_id(), ‘Account Type’, true); ?></h2>
<h3>Specialist Sectors</h3><h3>Telephone Number</h3>
<?php echo xprofile_get_field_data( ‘Telephone Number’, get_the_author_id()) ?>
<h3>Email</h3>
“><?php echo xprofile_get_field_data( ‘Contact Email Address’, get_the_author_id()) ?>Yes it works on profiles.php… but the text widget I use on a post page works for all the other xprofile fields?
Ah ok thanks, this code doesn’t seem to return anything, can you help me with the error?
<a href="/community/members/<?php echo get_the_author_meta('user_login') ?>"> <?php echo bp_core_fetch_avatar ( get_the_author_meta('user_email'), $size = '192' ); ?> </a>Hi there
I’m using it in a text widget sidebar, which works for all the other fields.
The spelling is correct and there are multiple options selected.
Thanks,
Ian
Unfortunately that is returning blank too @henrywright-1
Thanks
OK thanks…so I have switched it around as follows:
<?php echo get_the_author_id(), xprofile_get_field_data( 'Specialist Sectors', $multi_format = 'comma' ) ?>I am now getting something returned, which is unique for each user but it’s returning a number, such as 52, 65 or 1 – I don’t know what these refer to.
Any ideas?
Thanks all… @shanebp I’ve inputted the following but it isn’t showing anything, is my implementation incorrect?
<?php echo xprofile_get_field_data( 'Specialist Sectors', get_the_author_id(), $multi_format = 'comma' ) ?>Thanks
I See.
Screenshot is here of what we are doing:

I am trying to use it in a sidebar widget on a post page. Using the following PHP in the text widget to get back users info:
<div class="<?php echo get_post_meta(get_the_id(), 'Account Type', true); ?>"> <a href="/community/members/<?php echo get_the_author_meta('user_login') ?>"> <?php echo get_avatar ( get_the_author_meta('user_email'), $size = '192' ); ?> </a> <a href="/community/members/<?php echo get_the_author_meta('user_login') ?>"><h2 class="profileHeader"> <?php echo get_the_author(); ?></h2></a> <h2 class="profileAccount"><?php echo get_post_meta(get_the_id(), 'Account Type', true); ?></h2> <h3>Specialist Sectors</h3> <?php echo xprofile_get_field_data( 'Specialist Sectors', get_the_author_id()) ?> <h3>Experience</h3> <?php echo xprofile_get_field_data( 'Experience', get_the_author_id()) ?> <h3>About</h3> <?php echo xprofile_get_field_data( 'About you', get_the_author_id()) ?>Thanks,
Ian
Really trying to get this one sorted, can’t find a fix – anybody know?
Does anyone know of a way do get most recent post in the members loop for each author? Thanks.
Can anyone help with this?
Thanks
Anyone know if this is possible?
I’ve fixed this, this was solved when there was an additional js file being called from the footer in the Reverie file:
<script src="<?php echo get_template_directory_uri(); ?>/js/jquery.min.js"></script>Removing this duplicate fixed the issue.
