Support » Plugins » Hacks » Buddypress – Blog Categories for Groups plugin hack

  • Resolved monkfish13


    Hello community.

    I am hoping that somebody would be able give me some advice or explanation into this issue.

    I am using Buddypress with the buddydev plugin Blog Categories for Groups

    I love buddypress and the way that it integrate with WP, and so far everything is working well.

    However, the plugin is giving me a headache and I cannot work out what i need to change in the code to make it do what i want.

    So here is the issue:

    I am using the plugin to link blog categories to groups, so members of the groups can see posts that are associated with that group.

    The plugin generates an archive under the group heading in buddypress
    with permalinks to each relevant post

    However, when you click on each permalink, it continues to display the blog post under the group header, which affects its layout.

    How do I get the plugin to permalink to the original WP blog entry ?

    If i am right, it has something to do with these lines of code, as this is where each relevant title is called in the plugin template;

    <div class="post-content">
    							<h2 class="posttitle"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'bcg' ); ?></a></h2>
                                							<p class="date"><?php the_time() ?> <em><?php _e( 'in', 'bcg' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'bcg' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
    							<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'bcg' ), ', ', '<br />'); ?></span> <span class="comments"><?php comments_popup_link( __( 'No Comments »', 'bcg' ), __( '1 Comment »', 'bcg' ), __( '% Comments »', 'bcg' ) ); ?></span></p>

    how do i change this code to point towards the original blog entry in the, so the user is sent to the single post, rather than having to view the post in a nested fashion?

    With thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Further to the request above, through a process of elimination I have managed this:

    Using the following code from the plugin’s template_tag file thus :

    //get post permalink which leads to group blog single post page
    function bcg_get_post_permalink($post){
        global $bp;
          return bp_get_group_permalink($bp).$post->post_name;
    function bcg_pagination($q) {
    		$posts_per_page = intval(get_query_var('posts_per_page'));
    		$paged = intval(get_query_var('paged'));
    		$numposts = $q->found_posts;
                    $max_page = $q->max_num_pages;
    		if(empty($paged) || $paged == 0) {
    			$paged = 1;
         $pag_links = paginate_links( array(
    			'base' => add_query_arg( array( 'paged' => '%#%', 'num' => $posts_per_page ) ),
    			'format' => '',
    			'total' => ceil($numposts / $posts_per_page),
    			'current' => $paged,
    			'prev_text' => '?',
    			'next_text' => '?',
    			'mid_size' => 1
    echo $pag_links;

    It renders the permalinks like so –

    It appears to be the return function on line 4 that controls the post permalink.

    What do I need to do to this line to make the rendered permalink point to the original post – NOT within a group – like so;

    Any assistance or thoughts would be very much appriciated.

    Moderator bcworkz


    return site_url() . '/' . $post->post_name;

    The problem is you will need to re-apply this hack every time the plugin is updated.

    Perfect. Thank you Bcworkz

    Don’t mind re-applying the hack – it’s pretty simple once in a while.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Buddypress – Blog Categories for Groups plugin hack’ is closed to new replies.