Forum Replies Created
-
In reply to: Filtering activities by recorded date
In the past I have done this by grabbing a large number of activities with bp_has_activities, and iterate over the items with foreach( $activities->activities as $activity). For each $activity, check the time. Once they’re older than 24 hours, chuck the rest of $activities->activities.
Not ideal, and not really good for efficiency (since you end up looping through the array twice, once during this purge and once during while ( bp_activities() )) but better than nothing
In reply to: pagination within my plugin shortcodeUse paginate_links() https://codex.wordpress.org/Function_Reference/paginate_links. It’s not very easy to use (IMHO) but it’s better than doing it from scratch.
Hi @becca37.
(a) Yes, that’s what “kick and ban” does. I used that terminology because that’s what’s built into BP. It just means that removed members cannot reapply for membership (I think). I could probably build something that simply removed a member from a group. Maybe in the next version.
In reply to: How to manage users & their extended profiles?I’d like to develop this at some point, but it won’t happen for the next month or two because of other obligations. Please feel free to hack away at my code until then!
Inside of the while( bp_profile_groups() ) loop for each member, check to see if bp_the_profile_group_name() is one that should be displayed to that particular user. In other words, put the template markup inside of a big conditional:
if ( bp_the_profile_group_name() == 'awesome' && get_usermeta( $bp->loggedin_user->id, 'awesome_user' ) ) {
// Show the profile fields in the 'awesome' group only for those users with the usermeta 'awesome_user'
}
Do that for each user type and each profile field group. Only the right stuff will be displayed; groups not meeting the criteria will be hidden.
In reply to: Adding Subnav Link to Group Pagesheh heh…I am an educator at heart.
I think a good enhancement would be to allow dummy tabs, ie tabs that go to a more-or-less hardcoded URL (which is essentially what you have above). That could either be another argument in bp_core_new_subnav_item or another function like bp_core_new_subnav_link().
In reply to: How to manage users & their extended profiles?@mazen – @djpaul‘s advice is good, you should use bp_has_members()
You might want to have a look at a plugin I wrote called BP Group Management http://teleogistic.net/code/buddypress/bp-group-management/ which creates a similar sort of admin panel, except for groups.
In reply to: Adding Subnav Link to Group PagesI think the answers are:
(1) No
(2) No

(2) means you’ll have to rebuild stuff like $group_link once you get into the screen function.
In reply to: How to make sure the admin bar is allways on top.To the best of my knowledge, there is no place in the bp-default javascript where z-index would be overwritten or affected. Are you using a child of bp-default, or the BuddyPress Template Pack, or something totally custom? Is there a link you can share?
In reply to: Unable to exclude page from navigationThe code that people are giving should work. The only way we could test any further is if you posted the code you’re trying to use in context. Are you using a common theme, or one you developed yourself? If the latter, can you put the contents of header.php into a pastebin so others can test it?
In reply to: Making bp_has_activities() have a global scopeHere are some of the accepted arguments: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/
Also, check out the inline documentation in buddypress/bp-activity/bp-activity-templatetags.php.
@nuprn1 is right that you need to pass in user_id=0.
In reply to: Buddypress needs to STOP supporting bbPressI’d be happy to jump in and provide what help I can. Are you guys developing in a shared repo? PM me the creds
In reply to: Buddypress needs to STOP supporting bbPressCustom post types seem better to me in most ways. They have the full force of WP behind them, which means that things like attachments, media, and all sorts of other plugins will just work. The theming architecture is very well established, since it just uses the regular WP post loop. And you’d have the full admin power of the WP Dashboard for managing posts and replies.
The advantages of embedding forums in the activity stream vs custom post types? For one thing, the metadata attached to custom post types does not include things like group ids. I’d have to look into it a little more, but it seems to me that you’d probably have to do more lookups in order to get all the necessary information out of the post table than you do for the optimized activity table for this reason. And it certainly does seem more BP-centric to put things in the activity stream.
I think the decision should largely be made on the basis of a discussion that was started here about six months ago but kind of died off: what is the role of the activity stream? There is a real advantage to making all content types stored in the same way, whether it be in post types or in the activity stream – that much is clear to anyone who’s done BP development. The activity stream increasingly seems like a good option. But my worry is that if you push everything into the activity stream, you end up needlessly reproducing a lot of functionality that already exists in WP post types.
@Anointed Please do share your forum post type when you think it’s presentable. I’d love to see how you’ve set it up. I haven’t tried it myself, but just thinking about it I imagine it wouldn’t be too complex – most of the work would be done in the front-end theming and P2-style posting interface.
Awesome, glad it works!
It’s best to make your changes in a child theme rather than in bp-default. Just copy the file from bp-default into your theme file and edit it there, and it’ll override the default theme file. Make sure you respect the directory structure; groups/home.php has to go in a folder called groups in your child theme or it won’t be recognized.
In reply to: Buddypress needs to STOP supporting bbPressrich – What do you think is the advantage of rewriting the forums on the activity stream as opposed to with custom post types? I can think of a couple reasons to go either way, but I’m curious to know what you think.
In reply to: SVN Questions ..Alternatively, from the command line, cd to the plugin directory, then
svn add ./
then
svn ci -m "Checking in new code"In reply to: Exclude Category from Activity Stream@stef78 If the activity items already exist, you can try something like the following: http://pastebin.com/baERuzVQ
Obviously there are some holes to be filled in, but the comments should lead you in the right direction.
This is not, by the way, a very efficient way to handle it, as switch_to_blog() is a bit of a resource hog. It’d be better to keep those activity items from being written in the first place. Look in bp-blogs.php to see how the bp_blogs_record_post() function works. I suggest that you hook to save_post (like bp_blogs_record_post() is) witha lower priority, do your category check, and then unhook bp_blogs_record_post from save_post if the post is in the returned category.
If you just want to display static content on the group’s home page in place of the activity stream, I wouldn’t go hacking activity-loop.php (it’s too far upstream, so to speak). In [your-theme]/groups/single/home.php, there’s a string of conditionals starting around line 28. Play with them to get what you want.
As for the current group id, you can get that from bp_get_group_id() when inside the bp_has_groups() loop.
In reply to: Group Blog Error@study You might have more luck finding help if you post your question in a new forum topic. This thread has to do with the BP Groupblog plugin, which seems unrelated to your problem.
In reply to: BuddyPress as a school networkYour second, third and fourth requests can be taken care of by making sure the groups are set as Private. That means that they don’t show up in public listings, and their contents are only visible to members of the group.
In order to make sure that people can only be part of a single group, you’ll want to hide the Send Invite screen for all users, or at least for non-admins. You could either do this through CSS, or by modifying/reproducing the functionality defined at bp-groups.php groups_setup_nav().
As for the first question, there are WP plugins that allow you to restrict membership to invited members. A ten-second Google search turned up this: https://wordpress.org/extend/plugins/wp-invites/, for example. I imagine that this would work fine for BP as well. The most straightforward way to populate groups would then be for the admin to use a plugin like BP Group Management http://teleogistic.net/code/buddypress/bp-group-management/, which allows admins to place people manually in groups, bypassing the invitation process.
In reply to: How to add special custom field into the profile?Without a lot of custom coding, I don’t think you’re going to be able to make this work with xprofile fields. Those fields can only store data when they have been defined in the wp_bp_xprofile_fields table, but if they’re dynamically generated, that’ll be hard to do. It might be more straightforward to save the data as usermeta.
I guess I’m assuming that you want to save the field data in the bp database tables. Or are you just hoping to display the checkboxes on the profile page, and have them handled by another script?
In either case, as long as you can add fields to the profile page (which you could do either by hardcoding or hooking to the edit screen at bp_after_profile_field_content), you should be able to grab the $_POST data after xprofile edits are saved (at xprofile_screen_edit_profile) and then do whatever you want with it.
In reply to: 404 error on bp links@drmunden Like @claud925 said, it’s probably a permalink issue. What are your settings at Dashboard > Settings > Permalink? BuddyPress will not work with permalinks set to the default option. On your live server, do WP pretty (ie non-default) permalinks work without BP activated? If not, it’s likely that your host does not have the proper modules to allow for permalink rewrites, and you should contact them to ask whether they can enable it.
In reply to: How to make sure the admin bar is allways on top.Sounds like a z-index problem. These things can be very tricky to solve even when you have the code in front of you, much less when you’re flying blind like I am
, but here are some things to look at:
– Look in the stylesheet of your theme to see if the header has a z-index set. If so, try lowering it.
– Make sure that everything you’re trying to layer (both the header and the admin bar) are explicitly positioned in the stylesheet.The short answer is that you take the code that creates the activity post box (located in buddypress/bp-themes/bp-default/activity/post-form.php) and put it somewhere into one of the members/single profile templates, possibly home.php. I’ve done this on http://commons.gc.cuny.edu (though you won’t be able to see the post box without a login). It took quite a bit of playing around to get it to work right, especially to get the necessary Javascript in place.
I’m hoping @apeatling will post a quick tutorial on how he did it here on bp.org. I’m planning on writing something up about how I did it, but I’m sure his method was cleaner.