Want more features on Pastebin? Sign Up, it's FREE!
Guest

Forum-Topic-Group-Topic-BuddyPress-Hack

By: a guest on Aug 4th, 2010  |  syntax: None  |  size: 3.45 KB  |  views: 243  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Here is the mix of things for the Group/forum-tags I'm using with my BPress Site:
  2.  
  3. //FIRST Add this to the functions.php -It came from here: http://bbpress.org/forums/topic/changing-tag-list-view
  4.  
  5. //topic tags as row
  6. function bb_row_tags( $args = null ) {
  7.         $defaults = array(
  8.                 'tags' => false,
  9.                 'format' => 'row',
  10.                 'topic' => 0,
  11.         );
  12.  
  13.         $args = wp_parse_args( $args, $defaults );
  14.         extract( $args, EXTR_SKIP );
  15.  
  16.         if ( !$topic = get_topic( get_topic_id( $topic ) ) ) {
  17.                 return false;
  18.         }
  19.  
  20.         if ( !is_array( $tags ) ) {
  21.                 $tags = bb_get_topic_tags( $topic->topic_id );
  22.         }
  23.  
  24.         if ( !$tags ) {
  25.                 return false;
  26.         }
  27.  
  28.         $r = '';
  29.         switch ( strtolower( $format ) ) {
  30.                 case 'row' :
  31.                 default :
  32.                         $args['format'] = 'row';
  33.                         foreach ( $tags as $tag ) {
  34.                                 $r .= _bb_row_tag_item( $tag, $args );
  35.                         }
  36.                         break;
  37.         }
  38.         echo $r;
  39. }
  40.  
  41. function _bb_row_tag_item( $tag, $args ) {
  42.         $url = esc_url( bb_get_tag_link( $tag ) );
  43.         $name = esc_html( bb_get_tag_name( $tag ) );
  44.         if ( 'row' == $args['format'] ) {
  45.                 $id = 'tag-' . $tag->tag_id . '_' . $tag->user_id;
  46.                 return "\t" . '<a href="' . $url . '" rel="tag">' . $name . '</a>' . "\n";
  47.         }
  48. }
  49.  
  50. //SECOND -Change Rich's Code Found here to this:
  51.  
  52. <div id="forum-topic-tags">
  53.  
  54. <?php _e('<p><b>Specific Forum Topic Tags:</b></p>'); ?>
  55.  
  56. <?php
  57. $ttags = bb_get_topic_tags( bp_get_the_topic_id() );
  58. if ( $ttags ) : ?>
  59.  
  60. <?php bb_row_tags( 'topic='. bp_get_the_topic_id() .'tags='.$ttags ); ?>
  61.  
  62. <?php else : ?>
  63.  
  64. <?php printf(__('<p>No <a href="%s">tags yet.</p>'), bp_get_forum_directory_permalink() . '/#tags' ); ?>
  65.  
  66. <?php endif; ?>
  67.  
  68. </div>
  69.  
  70. //THIRD add the above combined with what is listed below (will also add groups tag heat map) to the topic.php file in the groups/single/forum of the theme...
  71.  
  72.  
  73. // This is Directly Above --> <?php if ( bp_has_forum_topic_posts() ) : ?>  ADD BELOW -Not this line.
  74.  
  75.        
  76. <div id="topic-tags">
  77.  
  78. <p><b>Popular Topic Tags From Across The Groups:</b></p>
  79.  
  80. <?php bb_tag_heat_map(array( 'smallest' => 9, 'largest' => 15, 'limit' => 50)); ?>
  81. </div>
  82.  
  83. <div id="forum-topic-tags">
  84.  
  85. <?php _e('<p><b>Specific Forum Topic Tags:</b></p>'); ?>
  86.  
  87. <?php
  88. $ttags = bb_get_topic_tags( bp_get_the_topic_id() );
  89. if ( $ttags ) : ?>
  90.  
  91. <?php bb_row_tags( 'topic='. bp_get_the_topic_id() .'tags='.$ttags ); ?>
  92.  
  93. <?php else : ?>
  94.  
  95. <?php printf(__('<p>No <a href="%s">tags yet.</p>'), bp_get_forum_directory_permalink() . '/#tags' ); ?>
  96.  
  97. <?php endif; ?>
  98.  
  99. </div>
  100.  
  101.  
  102. //This is directly below --> <form action="<?php bp_forum_topic_action() ?>" method="post" id="forum-topic-form" class="standard-form"> ADD ABOVE -not this line
  103.  
  104. //FOURTH Add some CSS to your default.css file:
  105.  
  106. #topic-tags {
  107. border-top: 2px solid #0066FF;
  108. Border-bottom: 2px solid #0066FF;
  109. background-color:#FFF4BB;
  110. padding-top:3px;
  111. padding-left:6px;
  112. padding-right: 6px;
  113. padding-bottom:10px;
  114. }
  115.  
  116. #forum-topic-tags {
  117. border-top: 1px solid #FFFFFF;
  118. Border-bottom: 2px solid #0066FF;
  119. background-color:#FFEC8E;
  120. padding-top: 8px;
  121. padding-left: 6px;
  122. padding-right 6px;
  123. padding-bottom 10px;
  124. margin-bottom: 7px;
  125. }
  126.  
  127. //That is what I did... I'm not a programmer and this is certainly a hack, but it is working
clone this paste RAW Paste Data