Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1,776 through 1,800 (of 2,756 total)
  • @henrywright

    Moderator

    /wp-content/plugin/buddypress/bp-activity/activity-template.php is a core file and you are indeed right to think that any changes you make will be overwritten when you upgrade the plugin.

    As I mentioned earlier, you should modify your activity template (sorry for not being clearer). The link I provided (to the BuddyPress Template Hierarchy) explains how you can create your own templates.

    To explain what I meant about bp_activity_add(), you’d write your own function which contains a call to bp_activity_add(). bp_activity_add() will add an item to the activity stream for you. Hooks are a feature of WordPress, you can read more about them here. You’d hook your custom function to a particular action which will result in bp_activity_add() executing at exactly the time you need it to.

    Hooks take a bit of getting your head around at first, but once you master them you’ll see how powerful they can be.

    PS – When I crack it, is there any way I can contribute to the codex so other newbies like me have access to the stuff? How?

    Sure you can! See the Participate and Contribute article for info on how you can help improve BP documentation.

    Hope all this info helps! Give me a shout if you need any further help

    @henrywright

    Moderator

    Careful not to confuse the bp_get_activity_user_id filter hook with the bp_get_activity_user_id() function.

    See here for the function and here for the hook.

    @henrywright

    Moderator

    @arcangelgirl great to hear you got it working! The same idea will apply to the activity stream. You’ll need to make sure you’re using bp_get_activity_user_id() in the right place.

    @henrywright

    Moderator

    I do not want to ‘add’ new activity. I just want that when one visits example.com/activity, it displays… …all updates in private/ hidden groups where the concerned person is a member (this is NOT displayed currently.) How do I do that?

    You have to ‘add’ the new activity.

    Regarding the second bullet point, you’d need to modify your activity loop which will be inside your activity template. Try something like this:

    <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&display_comments=stream' ) ) : ?>
        <?php while ( bp_activities() ) : bp_the_activity(); ?>
     
            <?php locate_template( array( 'activity/entry.php' ), true, false ); ?>
     
        <?php endwhile; ?>
    <?php endif; ?>

    For more info on the BuddyPress template system and where you find your activity template, please see this article.

    @henrywright

    Moderator

    In the case of private messages, bp_get_the_thread_message_sender_id() is the function you should be using. The problem might be related to where you’re calling from (i.e. the member’s ID might not be accessible at the point where you are using the function).

    For example, the bp_get_the_thread_message_sender_id() function must be used within a single message thread. Used anywhere else, it will return 0.

    @henrywright

    Moderator

    You could be right. I think bp_core_remove_nav_item() might do a little more than just visually removing an item from the member’s nav menu.

    If it helps, this is the method that adds the item to the nav menu.

    @henrywright

    Moderator

    @shanebp completely forgot about bp_is_my_profile() 😀

    @henrywright

    Moderator

    Try changing:

    // Bail if not the achievements page.
    if ( bp_current_action() != 'achievements' )
        return;

    to:

    if ( bp_is_user() && bp_is_current_component( 'achievements' ) && bp_is_current_action( 'all' ) )
        return;

    @henrywright

    Moderator

    @screampuff

    I experimented with the code but couldn’t get it to work

    Looking into it now…

    —

    As an aside, whilst looking through the plugin’s code, I noticed that endpoints (example.com/author/username/achievements) are used if you ever have BuddyPress disabled. Just something to keep in mind.

    @henrywright

    Moderator

    Hi @screampuff

    You can make that link private by doing something like this:

    function screampuff_hide_achi() {
        // Bail if the current user is the displayed user.
        if ( bp_loggedin_user_id() == bp_displayed_user_id() )
            return;
    
        // Bail if the current user is an admin.
        if ( current_user_can( 'manage_options' ) )
            return;
    
        // Bail if not the achievements page.
        if ( bp_current_action() != 'achievements' )
            return;
    
        // Redirect.
        wp_redirect( home_url() );
        exit;
    }
    add_action( 'template_redirect', 'screampuff_hide_achi' );

    Please note I haven’t tested. Also, I’m assuming the current action is ‘achievements’. It may be something else in which case the function will need a minor tweak.

    @henrywright

    Moderator

    bp_get_activity_user_id() is the function that you should be using. What does it return?

    @henrywright

    Moderator

    Hi @deshmukh

    • You can add items to the activity stream using bp_activity_add(). You’d write a custom function and hook it to the relevant action which fires when a group message has been posted (see a)
    • The display_comments parameter will help you here. You’ll need to change threaded to stream (see b)

    Refs:

    a) https://codex.buddypress.org/developer/function-examples/bp_activity_add/

    b) https://codex.buddypress.org/developer/loops-reference/the-activity-stream-loop/

    @henrywright

    Moderator

    Hi @neosnc

    Thanks for sharing. Importers are always welcome. Perhaps you’d like to make it available as a plugin?

    cc @djpaul – ref

    In reply to: ajax problem

    @henrywright

    Moderator

    Hi @vl4d

    You’ll need to include the specifics of your problem in order for the guys here to give useful help. AJAX problems can be very broad so suggesting a fix will be difficult on the info you’ve given.

    @henrywright

    Moderator

    Hi @mastodontmedia

    You’ll need to modify your members template. Check out the BuddyPress Template Hierarchy for more info on the template system.

    To show a specific profile field inside the loop, you can just do: bp_member_profile_data( 'field=the field name' );

    @henrywright

    Moderator

    What should it be using?

    Do you mean which redirection function? Either is fine – but my point was, the offending code will likely involve one of those functions. I thought it might be helpful me mentioning them if you were trying to debug…

    Your best bet is to contact the theme or plugin author (as @shanebp mentioned). They’ll probably be grateful for the bug report.

    @henrywright

    Moderator

    Hi @baldemotions

    wp_redirect(), wp_safe_redirect() or bp_core_redirect() are the functions that redirect. It could be that your theme is using one of those?

    @henrywright

    Moderator

    It’s definitely AJAX-related because as you mentioned earlier, visiting /members/?upage=2 works fine. I think the way to pin-point the problem now that you can be sure the template isn’t the issue is focus your investigations on any customisation you’ve made elsewhere. Specifically, any JavaScript you’ve introduced (either in your theme or via a plugin perhaps?).

    @henrywright

    Moderator

    What theme is it that you’re using?

    There’s a couple of things you could look into.

    Firstly, how does the markup of your theme’s members page differ from that of the template file provided by BP (in bp-legacy)?

    Secondly, take a look at your theme’s JavaScript files (if it has any) to see if there’s anything that might conflict with BP’s JavaScript

    @henrywright

    Moderator

    Hi @iuriem

    I haven’t seen a plugin that can do this but try searching the WordPress Plugin Directory to see if anything is available.

    @henrywright

    Moderator

    Could you be using root profiles by any chance?

    If so, try:

    http://example.com/USERNAME/activity/

    @henrywright

    Moderator

    I think creating a user role with ‘forum-only’ capabilities is perhaps your best bet. Try asking over at the bbPress support forum. The guys over there are specialists when it comes to forums (bbPress) so you may find some more joy there.

    @henrywright

    Moderator

    Thanks @danbp for the update, thanks to @sbrajesh for saving the day and glad @chatty24 found a solution! 🙂

    @henrywright

    Moderator

    I think this might be a known issue but try searching on Trac to see if there’s an open ticket and if not then feel free to create one.

    @henrywright

    Moderator

    Then perhaps you have zero unread notifications?

Viewing 25 replies - 1,776 through 1,800 (of 2,756 total)
Skip to toolbar