Buddypress website help

Hi,

I maintain a website for a client that uses Buddypress and a selection of plugins to provide a "facebook like" experience to users with an account within the site. I was wondering if you could help with a few minor issues that I am unsure how to resolve?

1. I am using a plugin called Buddypress Wall that changes the activity stream to a Facebook style wall with Newsfeed, this also changes the "Favourite"/"Remove Favourite function" to a "Like" function. However, when this is clicked it still says "Remove Favourite" instead of "Unlike", is there a way to fix this?

2. Regarding the Newsfeed, I was also looking to add a link to this within the primary navigation without having to first go to the activity page (now Wall page), is there a way to add this?

3. When posting links without a trailing / within a users Buddypress activity or group, a strange bug occurs where it creates some kind of iframe of the website that was linked, is this a known bug and is there a way to resolve it?

Hope you can help!

Stuart

  • Predrag Dubajic

    Hey Stuart,

    Hope you're well :slight_smile:

    1. I am using a plugin called Buddypress Wall that changes the activity stream to a Facebook style wall with Newsfeed, this also changes the "Favourite"/"Remove Favourite function" to a "Like" function. However, when this is clicked it still says "Remove Favourite" instead of "Unlike", is there a way to fix this?

    I'm not familiar with this plugin but I did a quick test and it looks like BP is changing the button with jQuery.
    Good news is that those buttons are included in translation files so you could either use translation files or our Ultimate Branding plugin and its text change module to replace Remove Favourite with Unlike.

    2. Regarding the Newsfeed, I was also looking to add a link to this within the primary navigation without having to first go to the activity page (now Wall page), is there a way to add this?

    Can you tell me to what are you referring to with Primary Navigation, your site navigation or the navigation dropdown when you hover on the profile in admin bar?

    3. When posting links without a trailing / within a users Buddypress activity or group, a strange bug occurs where it creates some kind of iframe of the website that was linked, is this a known bug and is there a way to resolve it?

    I'm not sure about this and couldn't find much info online about it, perhaps you should check out with BP community by asking on their support forums:
    https://buddypress.org/support/

    Best regards,
    Predrag

  • Stuart

    Hi Predrag,

    Thanks for the quick reply!

    Regarding the Remove Favourite button, can you tell me what translation files would I edit to achieve this? I tried editing it using the Quick Localisation plugin that is meant to overwrite any text with text you specify but this had no effect?

    For the newsfeed link I am referring to the site navigation presented at the top of the page, within it is a Social dropdown menu that contain a series of links within which I was looking to add a Newsfeed link that is of course relative to the user, any ideas how to do this?

    I'll have a look on the BP community re the links issue though if you could also look into it further if you can it'd be much appreciated.

    Thanks again,
    Stuart

  • Predrag Dubajic

    Hi Stuart,

    Regarding the Remove Favourite button, can you tell me what translation files would I edit to achieve this? I tried editing it using the Quick Localisation plugin that is meant to overwrite any text with text you specify but this had no effect?

    I haven't used Quick Localisation plugin myself and the plugin is not updated for 2 years so it's possible that it won't work with latest WP version.
    You can go to /wp-content/plugins/buddypress/ folder and download buddypress.pot file.
    Edit the file using PoEditor or similar software and save the changes which will create two files now, buddypress.pot and buddypress.mo.
    Upload both files to /wp-content/languages/plugins/ and that should be it.

    For the newsfeed link I am referring to the site navigation presented at the top of the page, within it is a Social dropdown menu that contain a series of links within which I was looking to add a Newsfeed link that is of course relative to the user, any ideas how to do this?

    You should be able to do this by adding this code to your child theme functions.php or creating new mu-plugin:

    add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
    function your_custom_menu_item ( $items, $args ) {
    		$username = wp_get_current_user();
            $items .= '<li><a href="http://ukgamestalent.com/members/'.$username->display_name.'/activity/news-feed/">Newsfeed</a></li>';
        return $items;
    }

    I'll have a look on the BP community re the links issue though if you could also look into it further if you can it'd be much appreciated.

    BP just released new version, do you still have issues after updating to it?

    Best regards,
    Predrag

  • Stuart

    Thanks Predrag, I managed to put custom text of the favourite buttons using this code for reference:

    remove_action( 'wp_ajax_activity_mark_fav', 'bp_dtheme_mark_activity_favorite' );
    remove_action( 'wp_ajax_nopriv_activity_mark_fav', 'bp_dtheme_mark_activity_favorite' );
    
    remove_action( 'wp_ajax_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' );
    remove_action( 'wp_ajax_nopriv_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' );
    
    function custom_like_text(){
        // Bail if not a POST action
        if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
            return;
    
        if ( bp_activity_add_user_favorite( $_POST['id'] ) )
            _e( 'Unlike', 'buddypress' );
        else
            _e( 'Like', 'buddypress' );
    
        exit;
    }
    
    function custom_unlike_text(){
        // Bail if not a POST action
        if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
            return;
    
        if ( bp_activity_remove_user_favorite( $_POST['id'] ) )
            _e( 'Like', 'buddypress' );
        else
            _e( 'Unlike', 'buddypress' );
    
        exit;
    }

    Thanks for the Newsfeed link code, not sure how do I put this into the Dropdown menu item though rather than as a "no-parent" item?

    I'm afraid the issue with links embedding webpages still exists even with the new update to BP, you can see an example of it on my own activity wall here:
    http://ukgamestalent.com/members/stupulsenorth-co-uk/

    Seeing it there do you have any ideas how to stop it doing that?

    Thanks again,
    Stuart

  • Milan

    Hello Stuart,

    Hope you are well today and won't mind me chiming here. :slight_smile:

    Thanks for the Newsfeed link code, not sure how do I put this into the Dropdown menu item though rather than as a "no-parent" item?

    I am sorry but I am not getting this, Would you be kind enough to tell me in depth what you are asking us for ?

    I'm afraid the issue with links embedding webpages still exists even with the new update to BP, you can see an example of it on my own activity wall here:
    http://ukgamestalent.com/members/stupulsenorth-co-uk/

    Then there is only helping hand for this and that's BuddyPress community. Please raise this issue there. Hopefully they will be able to provide fix or update for this. :slight_smile:

    Cheers,
    Milan

  • Stuart

    Hi Milan,

    Thanks for your reply, to answer your query I was looking to add the Newsfeed link to the dropdown menu within the primary navigation. Apologies, I may have not made you aware that this menu only appears for users that are logged in so you might not be able to see it. Is there a way to add this as a child of the dropdown menu without it appearing to non-logged in users as a Parent link?

    Thanks,
    Stuart

  • Predrag Dubajic

    Hi Stuart,

    Adding the menu item in dropdown would require some additional coding, something like this should help:
    http://isabelcastillo.com/dynamically-sub-menu-item-wp_nav_menu

    In code from that example you will need to add this line:
    $username = wp_get_current_user();

    And the $url variable should be changed to this:
    '<li><a href="http://ukgamestalent.com/members/'.$username->display_name.'/activity/news-feed/">Newsfeed</a></li>'

    Another solution would be using this plugin to allow use of shortcodes in menu items and register new shortcode for dynamic link like this:

    // Add Shortcode
    function custom_shortcode() {
    
    	$username = wp_get_current_user();
    	$items .= '<li><a href="http://ukgamestalent.com/members/'.$username->display_name.'/activity/news-feed/">Newsfeed</a></li>';
    	return $items;
    
    }
    add_shortcode( 'custom_link', 'custom_shortcode' );

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.