Shape the future of Social networking with WordPress: Join Project Midnight Sun! The next generation platform for community building with WordPress!

BuddyDev

Search

Replies

  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: [Resolved] Buddypress profile completion #48522

    I have the code not redirect users on non buddypess pages

     
    // Do not redirect users on non bp pages.
    function buddydev_skip_redirect_on_non_bp_pages( $skip ) {
        if ( ! is_buddypress() ) {
            $skip = true;
        }
        return $skip;
    }
    add_filter( 'bp_force_profile_completion_skip_check', 'buddydev_skip_redirect_on_non_bp_pages' );
    

    but now I don’t want to skip the redirect on a specific woocommerce product page using the code provided earlier, but the code does not work. Users without profile photo can still access the (account-verification) product

  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: Disable ajax in follow button #48512

    This seemed to work but its not perfect

     /**
     * Disable ajax for follow button
     */
    function disable_ajax_bp_follow() {
    	if ( bp_is_user() && is_user_logged_in() && bp_displayed_user_id() ) {
        ?>
        <script type="text/javascript">
        jQuery(document).ready(function($) {
            var itemButtons = null;
            if ($('body.bp-nouveau').length) {
                itemButtons = $('ul.member-header-actions');
            } else {
                itemButtons = $('#item-buttons');
            }
    
            if (itemButtons && itemButtons.length) {
                itemButtons.off('click', '.follow-button a.follow, .follow-button a.unfollow');
                itemButtons.on('click', '.follow-button a.follow, .follow-button a.unfollow', function(event) {
                    event.preventDefault();
                    location.reload();
                });
            }
        });
        </script>
        <?php
    }
    }
    add_action( 'wp_footer', 'disable_ajax_bp_follow', 100 ); 
  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: Disable ajax in follow button #48503

    The code did not work, the ajax is still working instead of the whole page reloading

  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: Disable ajax in follow button #48480

    Hello Brajesh

    Thanks for the feedback please note that I’m using the legacy template as I can see body.bp-nouveau in the code

  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: Disable ajax in follow button #48418

    Yes im using Ray’s plugin from github

    Thanks sir

  • Participant
    Level: Guru
    Posts: 915

    This plugin https://wordpress.org/plugins/bp-profile-field-duplicator/ can be used to duplicate the (Name) field but the newly duplicated fields cannot be made to be the (PRIMARY) name field

  • Participant
    Level: Guru
    Posts: 915

    Hello Brajesh

    I would also prefer to use different fields but the issue is the (Name) field is the default primary buddypress registration field which handles names across the entire buddypress pages. This field cannot be duplicated and member types pro cannot apply conditional visibility to the field.

    Where this is an issue is I don’t want the field label name to be the generic (Name) but I want it to be more contextual like (First & Last Name), (Business Name) according to the selected member type.

    For Example

    When users register they only input only their first name instead of both first and last name because the label is just (Name) but If I use the label (First & Last Name) this will add more context for the type of data needed. Now the other problem is if I use the label (First & Last Name) and a user selects the member type BUSINESS then I feel the appropriate label now needs to change to (Business Name).

    Thanks

  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: [Resolved] Turn activity excerpt into clickable link #48185

    thanks Brajesh,

    This helped

    /* turn activity excerpt into a clickable link */
    add_filter( 'bp_activity_create_summary', function ( $summary, $content, $activity, $extracted_media ) {
    
    	if ( 'new_blog_post' !== $activity['type'] ) {
    	return $summary;
    }
    
    // Get post title.
    $post_title = get_the_title( $activity['secondary_item_id'] );
    
    // Get featured image.
    $featured_image = get_the_post_thumbnail( $activity['secondary_item_id'], 'thumbnail' );
    
    // Recreate summary.
    $summary = bp_create_excerpt(
    	html_entity_decode( $content ),
    	225,
    	array(
    		'html'              => false,
    		'filter_shortcodes' => true,
    		'strip_tags'        => true,
    		'remove_links'      => true,
    	)
    );
    
    $permalink = get_permalink( $activity['secondary_item_id'] );
    
    return "<a href='" . esc_url( $permalink ) . "'>" . $post_title . "</a>" . "<a href='" . esc_url( $permalink ) . "'>" . $featured_image . "</a>" . "<a href='" . esc_url( $permalink ) . "'>" . $summary . "</a>";
    
    }, 10, 4 );
  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: [Resolved] Buddypress register redirect url #48171

    Hi Brajesh

    Using the code you provided at https://buddydev.com/redirect-users-to-welcome-page-after-successful-registration-on-your-buddypress-based-social-network/

    How can I make the (welcome) page only accessible if the user is being redirected from the buddypress registration page, while any other direct access to (welcome) page will be redirected to home page

  • Participant
    Level: Guru
    Posts: 915
    Tosin on in reply to: [Resolved] Turn activity excerpt into clickable link #48170

    Gentle reminder sir, thanks