Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define( 'BPLANG', 'buddypress' );
- if ( file_exists( BP_PLUGIN_DIR . '/bp-languages/' . BPLANG . '.mo' ) ) {
- load_textdomain( 'buddypress', BP_PLUGIN_DIR . '/bp-languages/' . BPLANG . '.mo' );
- }
- function bp_cubepoint_send_notification ( $uid1, $uid2, $points ) {
- bp_core_add_notification( $uid1, $uid2, 'points', 'bp_cubepoint_points_awarded' );
- }
- add_action( 'bp_cubepoint_points_awarded', 'bp_cubepoint_send_notification', 10, 3 );
- function wishlist(){
- ?>
- <?php if ( is_user_logged_in() && is_single() && !has_tag('blog') && !has_tag('gallery') ) : ?>
- <?php endif; ?>
- <?php
- }
- add_action( 'bp_adminbar_menus', 'wishlist', 20 );
- class MY_Latest_Topics_Widget extends WP_Widget {
- function my_latest_topics_widget() {
- parent::WP_Widget( false, $name = __( 'New In The Forums', 'buddypress' ) );
- //if ( is_active_widget( false, false, $this->id_base ) )
- }
- function widget($args, $instance) {
- global $bp;
- extract( $args );
- if ( !is_numeric( $instance['forum_latest_limit'] ) )
- $instance['forum_latest_limit'] = 10;
- echo $before_widget;
- echo $before_title
- . $widget_name
- . $after_title;
- if ( bp_has_forum_topics( 'no_stickies=false&type=newest&page=false&max='. $instance['forum_latest_limit'] ) ) : ?>
- <ul id="widget-topic-list" class="croptext">
- <?php while ( bp_forum_topics() ) : bp_the_forum_topic(); ?>
- <li>
- <div class="item">
- <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>
- </div>
- </li>
- <?php endwhile; ?>
- </ul>
- <?php else: ?>
- <div>
- <p><?php _e( 'Sorry, there were no forum topics found.', 'buddypress' ) ?></p>
- </div>
- <?php endif;
- echo $after_widget;
- }
- function update( $new_instance, $old_instance ) {
- $instance = $old_instance;
- $instance['forum_latest_limit'] = strip_tags( $new_instance['forum_latest_limit'] );
- return $instance;
- }
- function form( $instance ) {
- $instance = wp_parse_args( (array) $instance, array( 'forum_latest_limit' => 10 ) );
- $forum_latest_limit = strip_tags( $instance['forum_latest_limit'] );
- ?>
- <table class="form-table">
- <tr>
- <th><label for="<?php echo $this->get_field_id( 'forum_latest_limit' ); ?>"><?php _e('Max Latest Topics to show:', 'buddypress'); ?></label></th>
- <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>
- </tr>
- </table>
- <?php
- }
- }
- function my_latest_topics_widgets_init() {
- add_action('widgets_init', create_function('', 'return register_widget("MY_Latest_Topics_Widget");') );
- }
- add_action( 'bp_register_widgets', 'my_latest_topics_widgets_init', 15 );
- class BP_Blog_Post_Fav {
- var $activity_id;
- function init() {
- add_action( 'the_post', array( &$this, 'get_blog_post_activity_id' ) );
- }
- function get_blog_post_activity_id() {
- global $current_blog, $post;
- if( isset($post->ID) ) :
- $activity_id = bp_activity_get_activity_id( array(
- 'user_id' => $post->post_author,
- 'type' => 'new_blog_post',
- 'component' => 'blogs',
- 'item_id' => $current_blog->blog_id,
- 'secondary_item_id' => $post->ID) );
- $this->activity_id = $activity_id;
- if( !empty($this->activity_id) ) {
- add_filter( 'bp_get_activity_favorite_link', array( &$this, 'bp_get_activity_favorite_link' ) );
- add_filter( 'bp_get_activity_unfavorite_link', array( &$this, 'bp_get_activity_unfavorite_link' ) );
- add_filter( 'bp_get_activity_is_favorite', array( &$this, 'bp_get_activity_is_favorite' ) );
- }
- endif;
- }
- function bp_get_activity_favorite_link() {
- global $current_blog;
- if( $current_blog->blog_id != BP_ROOT_BLOG )
- switch_to_blog( BP_ROOT_BLOG );
- $nonce = wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/favorite/' . $this->activity_id . '/' ), 'mark_favorite' );
- if( $current_blog->blog_id != BP_ROOT_BLOG )
- restore_current_blog();
- return $nonce;
- }
- function bp_get_activity_unfavorite_link() {
- global $current_blog;
- if( $current_blog->blog_id != BP_ROOT_BLOG )
- switch_to_blog( BP_ROOT_BLOG );
- $nonce = wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/unfavorite/' . $this->activity_id . '/' ), 'unmark_favorite' );
- if( $current_blog->blog_id != BP_ROOT_BLOG )
- restore_current_blog();
- return $nonce;
- }
- function bp_get_activity_is_favorite() {
- global $bp;
- return in_array( $this->activity_id, (array)bp_activity_get_user_favorites($bp->loggedin_user->id) );
- }
- }
- $my_bp_favorite = new BP_Blog_Post_Fav();
- $my_bp_favorite->init();
- function nfm_bp_avtar_upload_path_correct($path){
- if ( bp_core_is_multisite() ){
- $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
- }
- return $path;
- }
- add_filter('bp_core_avatar_upload_path', 'nfm_bp_avtar_upload_path_correct', 1);
- function nfm_bp_avatar_upload_url_correct($url){
- if ( bp_core_is_multisite() ){
- $url = get_blog_option( BP_ROOT_BLOG, 'siteurl' ) . "/wp-content/uploads/";
- }
- return $url;
- }
- add_filter('bp_core_avatar_url', 'nfm_bp_avatar_upload_url_correct', 1);
- function new_search_action() {
- global $bp;
- return apply_filters( 'new_search_action', $bp->root_domain . '/search' );
- }
- function custom_adminbar_search() {
- $mobSearch = '
- <li class="align-right" style="background:none;"><form action="http://www.riotcart.com/" method="get">
- <fieldset>
- <input value="Type your search here" name="s" id="adminbar-search" onfocus="this.value=\'\'" />
- <input type="submit" value="Go" id="adminbar-search-submit" />
- </fieldset>
- </form></li>
- ';
- echo apply_filters( 'bp_search_form', $mobSearch );
- }
- add_action('bp_adminbar_menus', 'custom_adminbar_search', 100);
- function modify_adminbar(){
- remove_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 );
- }
- add_action('plugins_loaded','modify_adminbar',99);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement