Advertisement
Guest User

Untitled

a guest
Nov 8th, 2011
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.98 KB | None | 0 0
  1. <?php
  2.  
  3. define( 'BPLANG', 'buddypress' );
  4. if ( file_exists( BP_PLUGIN_DIR . '/bp-languages/' . BPLANG . '.mo' ) ) {
  5.     load_textdomain( 'buddypress', BP_PLUGIN_DIR . '/bp-languages/' . BPLANG . '.mo' );
  6. }
  7.  
  8. function bp_cubepoint_send_notification ( $uid1, $uid2, $points ) {
  9.    
  10.     bp_core_add_notification( $uid1, $uid2, 'points', 'bp_cubepoint_points_awarded' );
  11.    
  12. }
  13.  
  14. add_action( 'bp_cubepoint_points_awarded', 'bp_cubepoint_send_notification', 10, 3 );
  15.  
  16.  
  17.  
  18.  
  19. function wishlist(){
  20. ?>
  21.  
  22.  
  23.  
  24. <?php if ( is_user_logged_in() && is_single() && !has_tag('blog') &&  !has_tag('gallery') ) : ?>
  25.                                
  26. <?php endif; ?>
  27.  
  28. <?php
  29. }
  30. add_action( 'bp_adminbar_menus', 'wishlist', 20 );
  31.  
  32.  
  33.  
  34.  
  35. class MY_Latest_Topics_Widget extends WP_Widget {
  36.  
  37.     function my_latest_topics_widget() {
  38.         parent::WP_Widget( false, $name = __( 'New In The Forums', 'buddypress' ) );
  39.         //if ( is_active_widget( false, false, $this->id_base ) )
  40.     }
  41.  
  42.     function widget($args, $instance) {
  43.         global $bp;
  44.  
  45.        
  46.             extract( $args );
  47.  
  48.         if ( !is_numeric( $instance['forum_latest_limit'] ) )
  49.             $instance['forum_latest_limit'] = 10;
  50.  
  51.         echo $before_widget;
  52.         echo $before_title
  53.            . $widget_name
  54.            . $after_title;
  55.  
  56.         if ( bp_has_forum_topics( 'no_stickies=false&type=newest&page=false&max='. $instance['forum_latest_limit'] ) ) : ?>
  57.  
  58.             <ul id="widget-topic-list" class="croptext">
  59.                 <?php while ( bp_forum_topics() ) : bp_the_forum_topic(); ?>
  60.                     <li>
  61.                         <div class="item">
  62.                             <div class="item-title"><a class="topic-title" href="<?php bp_the_topic_permalink() ?>" title="posted in <?php bp_the_topic_object_name() ?>"><?php echo bp_create_excerpt( bp_get_the_topic_title(), 10) ?></a></div>
  63.                            
  64.                         </div>
  65.                     </li>
  66.                 <?php endwhile; ?>
  67.             </ul>
  68.         <?php else: ?>
  69.             <div>
  70.                 <p><?php _e( 'Sorry, there were no forum topics found.', 'buddypress' ) ?></p>
  71.             </div>
  72.         <?php endif;
  73.  
  74.         echo $after_widget;
  75.     }
  76.  
  77.     function update( $new_instance, $old_instance ) {
  78.         $instance = $old_instance;
  79.         $instance['forum_latest_limit'] =  strip_tags( $new_instance['forum_latest_limit'] );
  80.  
  81.         return $instance;
  82.     }
  83.  
  84.     function form( $instance ) {
  85.         $instance = wp_parse_args( (array) $instance, array( 'forum_latest_limit' => 10 ) );
  86.         $forum_latest_limit = strip_tags( $instance['forum_latest_limit'] );
  87.  
  88.         ?>
  89.             <table class="form-table">
  90.                 <tr>
  91.                     <th><label for="<?php echo $this->get_field_id( 'forum_latest_limit' ); ?>"><?php _e('Max Latest Topics to show:', 'buddypress'); ?></label></th>
  92.                     <td><input id="<?php echo $this->get_field_id( 'forum_latest_limit' ); ?>" name="<?php echo $this->get_field_name( 'forum_latest_limit' ); ?>" type="text" value="<?php echo attribute_escape( $forum_latest_limit ); ?>" size="4" /></td>
  93.                 </tr>
  94.             </table>
  95.     <?php
  96.     }
  97. }
  98.  
  99. function my_latest_topics_widgets_init() {
  100.     add_action('widgets_init', create_function('', 'return register_widget("MY_Latest_Topics_Widget");') );
  101. }
  102. add_action( 'bp_register_widgets', 'my_latest_topics_widgets_init', 15 );
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. class BP_Blog_Post_Fav {
  117.  
  118.         var $activity_id;
  119.  
  120.         function init() {
  121.                 add_action( 'the_post', array( &$this, 'get_blog_post_activity_id' ) );
  122.         }
  123.  
  124.         function get_blog_post_activity_id() {
  125.                 global $current_blog, $post;
  126.                
  127.                 if( isset($post->ID) ) :
  128.                         $activity_id = bp_activity_get_activity_id( array(
  129.                         'user_id' => $post->post_author,
  130.                         'type' => 'new_blog_post',
  131.                         'component' => 'blogs',
  132.                         'item_id' => $current_blog->blog_id,
  133.                         'secondary_item_id' => $post->ID) );
  134.  
  135.                         $this->activity_id = $activity_id;
  136.  
  137.                         if( !empty($this->activity_id) ) {
  138.                                 add_filter( 'bp_get_activity_favorite_link', array( &$this, 'bp_get_activity_favorite_link' ) );
  139.                                 add_filter( 'bp_get_activity_unfavorite_link', array( &$this, 'bp_get_activity_unfavorite_link' ) );    
  140.                                 add_filter( 'bp_get_activity_is_favorite', array( &$this, 'bp_get_activity_is_favorite' ) );
  141.                         }              
  142.  
  143.                 endif;
  144.  
  145.         }
  146.  
  147.         function bp_get_activity_favorite_link() {
  148.                 global $current_blog;
  149.  
  150.                 if( $current_blog->blog_id != BP_ROOT_BLOG )
  151.                         switch_to_blog( BP_ROOT_BLOG );
  152.  
  153.                 $nonce = wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/favorite/' . $this->activity_id . '/' ), 'mark_favorite' );
  154.  
  155.                 if( $current_blog->blog_id != BP_ROOT_BLOG )
  156.                         restore_current_blog();
  157.  
  158.                 return $nonce;
  159.         }
  160.  
  161.         function bp_get_activity_unfavorite_link() {
  162.                 global $current_blog;
  163.  
  164.                 if( $current_blog->blog_id != BP_ROOT_BLOG )
  165.                         switch_to_blog( BP_ROOT_BLOG );
  166.  
  167.                 $nonce = wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/unfavorite/' . $this->activity_id . '/' ), 'unmark_favorite' );
  168.  
  169.                 if( $current_blog->blog_id != BP_ROOT_BLOG )
  170.                         restore_current_blog();
  171.  
  172.                 return $nonce;
  173.         }
  174.  
  175.         function bp_get_activity_is_favorite() {
  176.                 global $bp;
  177.  
  178.                 return in_array( $this->activity_id, (array)bp_activity_get_user_favorites($bp->loggedin_user->id) );
  179.         }              
  180. }
  181. $my_bp_favorite = new BP_Blog_Post_Fav();
  182. $my_bp_favorite->init();
  183.  
  184.  
  185.  
  186.  
  187.  
  188. function nfm_bp_avtar_upload_path_correct($path){
  189. if ( bp_core_is_multisite() ){
  190. $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
  191. }
  192. return $path;
  193. }
  194. add_filter('bp_core_avatar_upload_path', 'nfm_bp_avtar_upload_path_correct', 1);
  195.  
  196.  
  197. function nfm_bp_avatar_upload_url_correct($url){
  198. if ( bp_core_is_multisite() ){
  199. $url = get_blog_option( BP_ROOT_BLOG, 'siteurl' ) . "/wp-content/uploads/";
  200. }
  201. return $url;
  202. }
  203. add_filter('bp_core_avatar_url', 'nfm_bp_avatar_upload_url_correct', 1);
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210. function new_search_action() {
  211.     global $bp;
  212.  
  213.     return apply_filters( 'new_search_action', $bp->root_domain . '/search' );
  214. }
  215.  
  216. function custom_adminbar_search() {
  217.     $mobSearch = '
  218.         <li class="align-right" style="background:none;"><form action="http://www.riotcart.com/" method="get">
  219.                    <fieldset>
  220.                        <input value="Type your search here" name="s" id="adminbar-search" onfocus="this.value=\'\'" />
  221.                        <input type="submit" value="Go" id="adminbar-search-submit" />
  222.                    </fieldset>
  223.                </form></li>
  224.     ';
  225.  
  226.     echo apply_filters( 'bp_search_form', $mobSearch );
  227. }
  228. add_action('bp_adminbar_menus', 'custom_adminbar_search', 100);
  229.  
  230. function modify_adminbar(){
  231. remove_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 );
  232. }
  233. add_action('plugins_loaded','modify_adminbar',99);
  234.  
  235.  
  236.  
  237.  
  238.  
  239. ?>
  240.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement