Forum Replies Created
-
In reply to: Modify the activity loop
/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 tobp_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 inbp_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
In reply to: How to get user id of activityIn reply to: How to get user id of activity@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.In reply to: Modify the activity loopI 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.
In reply to: How to get user id of activityIn 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 return0.In reply to: How to make section of profile private?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.
In reply to: How to make section of profile private?@shanebp completely forgot about
bp_is_my_profile()😀In reply to: How to make section of profile private?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;In reply to: How to make section of profile private?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.
In reply to: How to make section of profile private?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.
In reply to: How to get user id of activitybp_get_activity_user_id()is the function that you should be using. What does it return?In reply to: Modify the activity loopHi @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_commentsparameter will help you here. You’ll need to changethreadedtostream(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/
In reply to: ajax problemHi @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.
In reply to: Show profile fields in description/ excerptYou’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' );In reply to: Edit Profile Redirects to different pageWhat 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.
In reply to: Edit Profile Redirects to different pagewp_redirect(),wp_safe_redirect()orbp_core_redirect()are the functions that redirect. It could be that your theme is using one of those?In reply to: [Resolved] Members page pagination brokenIt’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?).
In reply to: [Resolved] Members page pagination brokenWhat 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
In reply to: Display a Google Calendar in the user profileHi @iuriem
I haven’t seen a plugin that can do this but try searching the WordPress Plugin Directory to see if anything is available.
In reply to: [Resolved] What is the Member Activity URL?In reply to: Excluding role from (almost) everythingI 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.
In reply to: [Resolved] How To Get Notification Count? (Code)?In reply to: tags outside the sidebarI 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.
In reply to: [Resolved] How To Get Notification Count? (Code)?Then perhaps you have zero unread notifications?
- You can add items to the activity stream using