sbrajesh

Brajesh Singh

Jun 30th, 2010
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.95 KB | None | 0 0
  1. <?php
  2. remove_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 );
  3. add_action("bp_adminbar_menus","show_search_form_in_admin_bar");
  4. function show_search_form_in_admin_bar(){?>
  5. <div id="search-bar">
  6.  
  7. <form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
  8. <input type="text" id="search-terms" name="search-terms" value="" />
  9. <?php echo bp_search_form_type_select() ?>
  10.  
  11. <input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
  12. <?php wp_nonce_field( 'bp_search_form' ) ?>
  13. </form><!-- #search-form -->
  14.  
  15. <?php do_action( 'bp_search_login_bar' ) ?>
  16.  
  17. </div><!-- #search-bar -->
  18.  
  19. <?php }
  20.  
  21. add_filter("bp_search_form_type_select", "bpmag_remove_search_dropdown"  );
  22. function bpmag_remove_search_dropdown($select_html){
  23.     return '';
  24. }
  25. /**
  26.  *
  27.  * Show blog posts in search
  28.  */
  29. function bpmag_show_site_blog_search(){
  30.     ?>
  31.  <div class="blog-search-result search-result">
  32.  
  33.   <h2 class="content-title"><?php _e("News Search","bpmag");?></h2>
  34.    
  35.    <?php locate_template( array( 'search-loop.php' ), true ) ;  ?>
  36.    <a href="<?php echo bp_get_root_domain().'/?s='.$_REQUEST['search-terms']?>" ><?php _e("View All matched Posts","bpmag");?></a>
  37. </div>
  38.    <?php
  39.   }
  40.  
  41. //Hook Blog Post results to search page
  42.  add_action("advance-search","bpmag_show_site_blog_search",10);
  43.  
  44.  
  45. //show the search results for member*/
  46. function bpmag_show_member_search(){
  47.     ?>
  48.    <div class="memberss-search-result search-result">
  49.    <h2 class="content-title"><?php _e("Members Results","bpmag");?></h2>
  50.   <?php locate_template( array( 'members/members-loop.php' ), true ) ;  ?>
  51.   <?php global $members_template;
  52.     if($members_template->total_member_count>1):?>
  53.         <a href="<?php echo bp_get_root_domain().'/'.BP_MEMBERS_SLUG.'/?s='.$_REQUEST['search-terms']?>" ><?php _e(sprintf("View all %d matched Members",$members_template->total_member_count),"bpmag");?></a>
  54.     <?php   endif; ?>
  55. </div>
  56. <?php  
  57.  }
  58.  
  59. //Hook Member results to search page
  60. add_action("advance-search","bpmag_show_member_search",10); //the priority defines where in page this result will show up(the order of member search in other searchs)
  61. function bpmag_show_groups_search(){
  62.     ?>
  63. <div class="groups-search-result search-result">
  64.     <h2 class="content-title"><?php _e("Group Search","bpmag");?></h2>
  65.     <?php locate_template( array('groups/groups-loop.php' ), true ) ;  ?>
  66.    
  67.     <a href="<?php echo bp_get_root_domain().'/'.BP_GROUPS_SLUG.'/?s='.$_REQUEST['search-terms']?>" ><?php _e("View All matched Groups","bpmag");?></a>
  68. </div>
  69.     <?php
  70.  //endif;
  71.   }
  72.  
  73. //Hook Groups results to search page
  74.  if(bp_is_active( 'groups' ))
  75.     add_action("advance-search","bpmag_show_groups_search",10);
  76.  
  77. //show forums search
  78. function bpmag_show_forums_search(){
  79.     ?>
  80.  <div class="forums-search-result search-result">
  81.    <h2 class="content-title"><?php _e("Forums Search","bpmag");?></h2>
  82.   <?php locate_template( array( 'forums/forums-loop.php' ), true ) ;  ?>
  83.   <a href="<?php echo bp_get_root_domain().'/'.BP_FORUMS_SLUG.'/?s='.$_REQUEST['search-terms']?>" ><?php _e("View All matched forum posts","bpmag");?></a>
  84. </div>
  85.   <?php
  86.   }
  87.  
  88. //Hook Forums results to search page
  89. if ( bp_is_active( 'forums' ) && bp_is_active( 'groups' ) && ( function_exists( 'bp_forums_is_installed_correctly' ) && !(int) bp_get_option( 'bp-disable-forum-directory' ) ) && bp_forums_is_installed_correctly() )
  90.  add_action("advance-search","bpmag_show_forums_search",20);
  91.  
  92.  
  93. //show blogs search result
  94.  
  95. function bpmag_show_blogs_search(){
  96.  
  97.     ?>
  98.   <div class="blogs-search-result search-result">
  99.   <h2 class="content-title"><?php _e("Blogs Search","bpmag");?></h2>
  100.   <?php locate_template( array( 'blogs/blogs-loop.php' ), true ) ;  ?>
  101.   <a href="<?php echo bp_get_root_domain().'/'.BP_BLOGS_SLUG.'/?s='.$_REQUEST['search-terms']?>" ><?php _e("View All matched Blogs","bpmag");?></a>
  102.  </div>
  103.   <?php
  104.   }
  105.  
  106. //Hook Blogs results to search page if blogs comonent is active
  107.  if(bp_is_active( 'blogs' ))
  108.     add_action("advance-search","bpmag_show_blogs_search",10);
  109.  
  110.  
  111.  //modify the query string with the search term
  112. function bpmag_global_search_qs(){
  113.     return "search_terms=".$_REQUEST['search-terms'];
  114. }
  115.  
  116. function bpmag_is_advance_search(){
  117. global $bp;
  118. if($bp->current_component == BP_SEARCH_SLUG)
  119.     return true;
  120. return false;
  121. }
  122.  
  123. function bp_dtheme_add_custom_header_support() {
  124.         /* Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */
  125.  
  126.             define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
  127.                 define( 'HEADER_IMAGE', '/images/default_header.jpg' ); // %s is theme dir uri
  128.                     define( 'HEADER_IMAGE_WIDTH', 1250 );
  129.         define( 'HEADER_IMAGE_HEIGHT', 125 );
  130.  
  131.             function bp_dtheme_header_style() { ?>
  132.                         <style type="text/css">
  133.                         #header { background-image: url(<?php header_image() ?>); }
  134.                                     <?php if ( 'blank' == get_header_textcolor() ) { ?>
  135.                                 #header h1, #header #desc { display: none; }
  136.                             <?php } else { ?>
  137.                         #header h1 a, #desc { color:#<?php header_textcolor() ?>; }
  138.                                     <?php } ?>
  139.                         </style>
  140.   <?php
  141.           }
  142.  
  143.               function bp_dtheme_admin_header_style() { ?>
  144.                           <style type="text/css">
  145.                           #headimg {
  146. position: relative;
  147. color: #fff;
  148. background: url(<?php header_image() ?>);
  149. -moz-border-radius-bottomleft: 6px;
  150. -webkit-border-bottom-left-radius: 6px;
  151. -moz-border-radius-bottomright: 6px;
  152. -webkit-border-bottom-right-radius: 6px;
  153. margin-bottom: 20px;
  154. height: 100px;
  155. padding-top: 25px;
  156.                                       }
  157.  
  158.                                   #headimg h1{
  159.         position: absolute;
  160.         bottom: 15px;
  161.         left: 15px;
  162.         width: 44%;
  163.         margin: 0;
  164.         font-family: Arial, Tahoma, sans-serif;
  165.                               }
  166.                           #headimg h1 a{
  167. color:#<?php header_textcolor() ?>;
  168. text-decoration: none;
  169. border-bottom: none;
  170.                                       }
  171.                                   #headimg #desc{
  172.         color:#<?php header_textcolor() ?>;
  173.         font-size:1em;
  174.         margin-top:-0.5em;
  175.                               }
  176.  
  177.                           #desc {
  178. display: none;
  179.                                       }
  180.  
  181.                                   <?php if ( 'blank' == get_header_textcolor() ) { ?>
  182.                               #headimg h1, #headimg #desc {
  183.     display: none;
  184.                           }
  185.                                       #headimg h1 a, #headimg #desc {
  186.             color:#<?php echo HEADER_TEXTCOLOR ?>;
  187.                                   }
  188.                               <?php } ?>
  189.                   </style>
  190.                   <?php
  191.                       }
  192.           add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
  193.       }
  194.       if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
  195.               add_action( 'init', 'bp_dtheme_add_custom_header_support' );
  196.  
  197.  
  198.     ?>
Add Comment
Please, Sign In to add comment