vapvarun

show share button all time

Jan 17th, 2018
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.67 KB | None | 0 0
  1. Step 1 - Replace bp_share_activity_filter function's code with given code in buddypress-activity-social-share/public/class-buddypress-share-public.php at line number 116
  2.  
  3.  
  4.     /**
  5.      * BP Share activity filter
  6.      * @access public
  7.      * @since    1.0.0
  8.      */
  9.     function bp_share_activity_filter() {
  10.         $service         = get_option( 'bp_share_services' );
  11.         $extra_options   = get_option( 'bp_share_services_extra' );
  12.         $activity_type   = bp_get_activity_type();
  13.         $activity_link   = bp_get_activity_thread_permalink();
  14.         $activity_title  = bp_get_activity_feed_item_title(); // use for description : bp_get_activity_feed_item_description()
  15.         $plugin_path     = plugins_url();
  16.         if ( !is_user_logged_in() ) {
  17.             echo '<div class = "activity-meta" >';
  18.         }
  19.         $share_button_text   = 'Share';
  20.         $updated_text        = apply_filters( 'bpas_share_button_text_override', $share_button_text );
  21.         if ( isset( $updated_text ) ) {
  22.             $share_button_text = $updated_text;
  23.         }
  24.  
  25.         if ( !empty( $service ) ) {
  26.             foreach ( $service as $key => $value ) {
  27.                 if ( isset( $key ) && $key == 'bp_share_facebook' && $value[ 'chb_' . $key ] == 1 ) {
  28.                     echo '<a target="blank" class="bp-share" href="https://www.facebook.com/sharer/sharer.php?quote=' . $activity_title . '&u=' . $activity_link . '" rel="facebook"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  29.                 }
  30.                 if ( isset( $key ) && $key == 'bp_share_twitter' && $value[ 'chb_' . $key ] == 1 ) {
  31.                     echo '<a target="blank" class="bp-share" href="http://twitter.com/share?text=' . $activity_title . '&url=' . $activity_link . '" rel="twitter"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  32.                 }
  33.                 if ( isset( $key ) && $key == 'bp_share_google_plus' && $value[ 'chb_' . $key ] == 1 ) {
  34.                     echo '<a target="blank" class="bp-share" href="https://plus.google.com/share?url=' . $activity_link . '&text=' . $activity_title . '" rel="google-plus"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  35.                 }
  36.                 if ( isset( $key ) && $key == 'bp_share_pinterest' && $value[ 'chb_' . $key ] == 1 ) {
  37.                     $media   = '';
  38.                     $video   = '';
  39.                     echo '<a target="blank" class="bp-share" href="https://pinterest.com/pin/create/bookmarklet/?media=' . $media . '&url=' . $activity_link . '&is_video=' . $video . '&description=' . $activity_title . '" rel="penetrest"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  40.                 }
  41.                 if ( isset( $key ) && $key == 'bp_share_linkedin' && $value[ 'chb_' . $key ] == 1 ) {
  42.                     echo '<a target="blank" class="bp-share" href="http://www.linkedin.com/shareArticle?url=' . $activity_link . '&title=' . $activity_title . '"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  43.                 }
  44.                 if ( isset( $key ) && $key == 'bp_share_reddit' && $value[ 'chb_' . $key ] == 1 ) {
  45.                     echo '<a target="blank" class="bp-share" href="http://reddit.com/submit?url=' . $activity_link . '&title=' . $activity_title . '"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  46.                 }
  47.                 if ( isset( $key ) && $key == 'bp_share_wordpress' && $value[ 'chb_' . $key ] == 1 ) {
  48.                     $description = '';
  49.                     $img         = '';
  50.                     echo '<a target="blank" class="bp-share" href="http://wordpress.com/press-this.php?u=' . $activity_link . '&t=' . $activity_title . '&s=' . $description . '&i= ' . $img . ' "><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  51.                 }
  52.                 if ( isset( $key ) && $key == 'bp_share_pocket' && $value[ 'chb_' . $key ] == 1 ) {
  53.                     echo '<a target="blank" class="bp-share" href="https://getpocket.com/save?url=' . $activity_link . '&title=' . $activity_title . '"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  54.                 }
  55.                 if ( isset( $key ) && $key == 'bp_share_email' && $value[ 'chb_' . $key ] == 1 ) {
  56.                     $email = 'mailto:?subject=' . $activity_link . '&body=Check out this site: ' . $activity_title . '" title="Share by Email';
  57.                     echo '<a target="blank" class="bp-share" href="' . $email . '"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
  58.                 }
  59.             }
  60.         } else {
  61.             _e( 'Please enable share services!', BP_SHARE );
  62.         }
  63.         do_action( 'bp_share_user_services', $services = array(), $activity_link, $activity_title );
  64.         ?>
  65.         </div>
  66.         <script>
  67.             jQuery( document ).ready( function () {
  68.                 var pop_active = '<?php echo isset( $extra_options[ 'bp_share_services_open' ] ) ? $extra_options[ 'bp_share_services_open' ] : '' ?>';
  69.                 if ( pop_active == 1 ) {
  70.                     jQuery( '.bp-share' ).addClass( 'has-popup' );
  71.                 }
  72.             } );
  73.         </script>
  74.         <?php
  75.         if ( !is_user_logged_in() ) {
  76.             echo '</div>';
  77.         }
  78.     }
  79.  
  80. Step 2 - Add given css code in buddypress-activity-social-share/public/css/buddypress-share-public.css file.
  81.  
  82. a.bp-share{
  83.     font-size:22px;
  84.     margin:0px 10px;
  85. }
Add Comment
Please, Sign In to add comment