BuddyDev

Search

[Resolved] Add Group name on the post group

  • Participant
    Level: Initiated
    Posts: 7
    Alejandro on #34738

    Hi, im using your greate pluging “BP Simple Front End Post”…thanks for do it ๐Ÿ™‚
    When the group administrator create a post (from the group) the post sow the title , content and pictures. I would like to show the name of the group as a link on the post…i was trying to add some code but i am beginer in php and dont find the solution…
    I find out at \buddyblog\template\buddyblog\single.php the code that show the post information…and y add the code:
    <a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a>

    But i didnยดt get exit…:(

    I think is because I must let it know which group was the one that created the post…but i not have any idea…
    Any help or guide will be very helfull.

    Thanks for all

  • Keymaster
    (BuddyDev Team)
    Posts: 24642
    Brajesh Singh on #34756

    Hi Alejandro,
    Thank you for using our plugins.

    BuddyBlog does not allow posting to groups. Are you using blog categories for groups? If yes, we do store group id as post meta and can provide code to assist you with it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 7
    Alejandro on #34758

    Ok ….Yes, i al using blog categories for group ๐Ÿ™‚ It Will be nice if you could provide me some code…i am Lost:( where to add It…in function.php?
    Thank for you help

  • Participant
    Level: Initiated
    Posts: 7
    Alejandro on #34798

    Hi , now i underestand what you mean…sorry for the inconvenience…
    if i unistall buddyblog, then i can add the code into the blog categories for groups…because blog categories store the grup id as post meta…:) Thanks i tried and is run suscesful ๐Ÿ™‚ thanks from show me…now i think i now a bit more about how is work…
    My interest now is show the grup name on the post detail (if you go to the general post list, where all the posts of all groups appear, and select one post, then you go to the post detail). I think mybe these depent on muy theme… In these case, any clue how to do it?
    Thanks for your atention

  • Keymaster
    (BuddyDev Team)
    Posts: 24642
    Brajesh Singh on #34809

    Hi Alejandro,
    Thank you for the reply.

    You may use this snippet inside the post loop

    
    $group_id = get_post_meta( get_the_ID(), '_bcg_group_id', true );
    
    if ( $group_id ) {
    	$group = groups_get_group( $group_id );
    	printf( "<a href='%s'>%s</a>", esc_url( bp_get_group_permalink( $group ) ), bp_get_group_name( $group ) );
    }
    
    

    That will show the link to the associated group.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 7
    Alejandro on #34822

    Thanks very much ๐Ÿ™‚ Its works perfect !!!

  • Keymaster
    (BuddyDev Team)
    Posts: 24642
    Brajesh Singh on #34844

    You are welcome.

The topic ‘ [Resolved] Add Group name on the post group’ is closed to new replies.

This topic is: resolved