-
Author
-
November 27, 2015 at 15:07 #89531parousiaParticipant
Hi!
I’m using the code below to display a list of groups that belongs to the user. I would really like to be able to fetch the cover image for each group. Is there a way I can do that from within this code?
outcome of the code can be seen here – http://www.cultexposure.com/members/lauriedugdale/
Thanks!
COPY CODE$user_id = bp_displayed_user_id(); $getusername = your_name_or_company_name(); if ( bp_has_groups( 'type=alphabetical&max=6&user_id=' . $user_id )) { ?> <div class="inner-right"> <h3><?php echo $firstname; ?>'s <a href="http://www.cultexposure.com/members/<?php echo $getusername; ?>/groups/">groups</a></h3> <ul id="profile-group-list-wrap" class="my-groups-list item-list"> <?php while ( bp_groups() ) : bp_the_group(); ?> <li class="profile-group-list"> <div class="item-avatar"> <a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar_thumb() ?></a> </div> <div class="item"> <div class="item-title"><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></div> <div class="item-meta"><span class="activity"><?php bp_group_member_count() ?></span></div> </div> </li> <?php endwhile; ?> </ul> <?php wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' ); ?> <input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $instance['max_groups'] ); ?>" /> <div class="homepage-btn"> <a href="http://www.cultexposure.com/members/<?php echo $getusername; ?>/groups/"><span></span>Browse your groups</a> </div> </div> <?php } ?>
November 28, 2015 at 01:04 #89695LauraModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! 🙂Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
November 30, 2015 at 16:07 #90081RaduModeratorHi,
Do you have solved your issue , i see in your page a block of groups with cover image.
From you provided code this function it seems to be what you need
COPY CODEbp_group_avatar_thumb()
Cheers
Radu
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionNovember 30, 2015 at 21:19 #90177parousiaParticipantHi, thanks but the avatar retrieving the avatar isn’t the problem, its the cover image of the group I would like. Is this possible?
November 30, 2015 at 21:46 #90185RaduModeratorHi,
Sorry for misunderstanding,
I will get back to you tomorrow with an solution regarding to this.
Cheers
Radu
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionDecember 2, 2015 at 16:23 #90618parousiaParticipantThanks! When needed I’ve been fetching the user profile cover from user meta, but I don’t think the group cover is stored anywhere like that?
December 3, 2015 at 17:40 #90926RaduModeratorHi,
Try with this
COPY CODE$image_url = groups_get_groupmeta( bp_get_group_id(), 'bpcp_group_cover' );
Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionDecember 4, 2015 at 04:05 #91083parousiaParticipantUnfortunately its not working?
my code is below
COPY CODE<?php $user_id = bp_displayed_user_id(); $firstname = your_name_or_company_name(true); $getusername = bp_get_displayed_user_username(); $args = array( 'type' => 'alphabetical', 'max' => 6, 'user_id' => $user_id ); if ( bp_has_groups ( $args )) { ?> <div class="inner-right"> <h3><?php echo $firstname; ?>'s <a href="http://www.cultexposure.com/members/<?php echo $getusername; ?>/groups/">groups</a></h3> <ul id="profile-group-list-wrap" class="my-groups-list item-list"> <?php while ( bp_groups() ) : bp_the_group(); ?> <?php $image_url = groups_get_groupmeta( bp_get_group_id(), 'bpcp_group_cover' ); ?> <li class="profile-group-list" style="background-image:url("<?php echo $image_url; ?>")" > <div class="item-avatar"> <a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar_thumb() ?></a> </div> <div class="item"> <div class="item-title"><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></div> <div class="item-meta"><span class="activity"><?php bp_group_member_count() ?></span></div> </div> </li> <?php endwhile; ?> </ul> <div class="homepage-btn"> <a href="http://www.cultexposure.com/members/<?php echo $getusername; ?>/groups/"><span></span>Browse your groups</a> </div> </div> <?php } ?>
December 4, 2015 at 18:15 #91228RaduModeratorHi,
It works try now.
COPY CODE<?php $user_id = bp_displayed_user_id(); $getusername = bp_get_displayed_user_username(); $args = array( 'type' => 'alphabetical', 'max' => 6, 'user_id' => $user_id ); if ( bp_has_groups ( $args )) { ?> <div class="inner-right"> <h3><?php echo $firstname; ?>'s <a href="http://www.cultexposure.com/members/<?php echo $getusername; ?>/groups/">groups</a></h3> <ul id="profile-group-list-wrap" class="my-groups-list item-list"> <?php while ( bp_groups() ) : bp_the_group(); ?> <?php $image_url = groups_get_groupmeta( bp_get_group_id(), 'bpcp_group_cover' ); ?> <?php print_r($image_url);?> <li class="profile-group-list" style="background-image:url('<?php echo $image_url; ?>')" > <div class="item-avatar"> <a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar_thumb() ?></a> </div> <div class="item"> <div class="item-title"><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></div> <div class="item-meta"><span class="activity"><?php bp_group_member_count() ?></span></div> </div> </li> <?php endwhile; ?> </ul> <div class="homepage-btn"> <a href="http://www.cultexposure.com/members/<?php echo $getusername; ?>/groups/"><span></span>Browse your groups</a> </div> </div> <?php } ?>
Cheers
Radu
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Plugins questions’ is closed to new topics and replies.