Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- /**
- * BP Share activity filter
- * @access public
- * @since 1.0.0
- */
- function bp_share_activity_filter() {
- $service = get_option( 'bp_share_services' );
- $extra_options = get_option( 'bp_share_services_extra' );
- $activity_type = bp_get_activity_type();
- $activity_link = bp_get_activity_thread_permalink();
- $activity_title = bp_get_activity_feed_item_title(); // use for description : bp_get_activity_feed_item_description()
- $plugin_path = plugins_url();
- if ( !is_user_logged_in() ) {
- echo '<div class = "activity-meta" >';
- }
- $share_button_text = 'Share';
- $updated_text = apply_filters( 'bpas_share_button_text_override', $share_button_text );
- if ( isset( $updated_text ) ) {
- $share_button_text = $updated_text;
- }
- if ( !empty( $service ) ) {
- foreach ( $service as $key => $value ) {
- if ( isset( $key ) && $key == 'bp_share_facebook' && $value[ 'chb_' . $key ] == 1 ) {
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_twitter' && $value[ 'chb_' . $key ] == 1 ) {
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_google_plus' && $value[ 'chb_' . $key ] == 1 ) {
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_pinterest' && $value[ 'chb_' . $key ] == 1 ) {
- $media = '';
- $video = '';
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_linkedin' && $value[ 'chb_' . $key ] == 1 ) {
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_reddit' && $value[ 'chb_' . $key ] == 1 ) {
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_wordpress' && $value[ 'chb_' . $key ] == 1 ) {
- $description = '';
- $img = '';
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_pocket' && $value[ 'chb_' . $key ] == 1 ) {
- 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>';
- }
- if ( isset( $key ) && $key == 'bp_share_email' && $value[ 'chb_' . $key ] == 1 ) {
- $email = 'mailto:?subject=' . $activity_link . '&body=Check out this site: ' . $activity_title . '" title="Share by Email';
- echo '<a target="blank" class="bp-share" href="' . $email . '"><i class="' . $value[ 'service_icon' ] . '"></i></a>';
- }
- }
- } else {
- _e( 'Please enable share services!', BP_SHARE );
- }
- do_action( 'bp_share_user_services', $services = array(), $activity_link, $activity_title );
- ?>
- </div>
- <script>
- jQuery( document ).ready( function () {
- var pop_active = '<?php echo isset( $extra_options[ 'bp_share_services_open' ] ) ? $extra_options[ 'bp_share_services_open' ] : '' ?>';
- if ( pop_active == 1 ) {
- jQuery( '.bp-share' ).addClass( 'has-popup' );
- }
- } );
- </script>
- <?php
- if ( !is_user_logged_in() ) {
- echo '</div>';
- }
- }
- Step 2 - Add given css code in buddypress-activity-social-share/public/css/buddypress-share-public.css file.
- a.bp-share{
- font-size:22px;
- margin:0px 10px;
- }
Add Comment
Please, Sign In to add comment