Can we create buddypress modules for bb?

I want to create a custom module for beaverbuilder that is almost exactly like the posts module where it creates a list of buddypress profiles that are filtered on different parameters. Mine would keep the exact parameters as the posts layout tab but change the following parameters on the content tab:

Content

Label: xprofile fields to filter the list by
Options:

  1. location
  2. date of birth
  3. any custom field here

Label: Show users by following roles
Options:

  1. Administrator
  2. Author
  3. any custom role here

I tried to just use https://wordpress.org/plugins/bp-profile-widget-for-blogs/ to most of this but was told at the end of this post that it wasn’t possible: http://forum.wpbeaverbuilder.com/support/q/adapting-geodirectory-to-beaverbuilder-child-theme/

before I go down a custom path, I want to make sure this is even possible with bb.

I read in your documentation:

By default, the builder is only enabled for the "Page" post type. You can enable support for additional post types under Settings > Page Builder > Post Types in the admin area.

So that leaves me to wonder, can I even do this with bb? and what is the best approach?

Any advice is appreciated.

Hi Mikiah,

The content tab of the Posts module is coded to work with posts (of any type). Are BuddyPress profiles based on a custom post type? If so, it might work, otherwise, you would have to code a module from scratch. Anything is possible if you code a module from scratch, so I don’t see any reason why you couldn’t do this. Let me know how it goes.

Justin

No, buddypress members or activity is not registered as any custom post type.

I noticed that you have FLBuilderLoop::post_types()

I need to use bp_has_members(). Since they’re not post types, how would I go about registering them so I can iterate through them in a module?

https://codex.buddypress.org/developer/loops-reference/the-members-loop/

Hi Mikiah,

To let users select members using bp_has_members() you would need to create a custom field. Have a look at that section in the custom module docs and let me know if you have any questions.

Justin

I actually just copied most of the field settings from the post-grid module’s post-grid.php file in the core modules folder.

I did some configuration to the field names and have most of it structured the way I want it.

Now for the data.

I noticed that the post-grid frontend.php file calls the FLBuilderLoop class. That seems to get the data for the loop that follows.

I’m still getting my sea-legs with php. Would I need to create my own class that gets the data from bp_has_members(). Or could I just use bp_has_members and if so, how could I apply the ‘$settings’ that were set up in the loop-settings.php file?

Hi Mikiah,

Thanks for the additional info. The Posts module is using something for the Content tab that we call the “loop builder”. It can be easily inserted into any module to add support for posts.

Unfortunately, it’s not customizable and I don’t think it would work for your use case even if it was since it focuses on posts and taxonomies and you’re trying to work with users.

You would need to recreate the settings for the Content tab in the posts module and create the fields you need to work with user data.

The FLBuilderLoop class also works with post data, not user data, so you would need to create your own backend logic to work with that.

This sounds like a pretty complex module. Sorry I haven’t been able to be much help! Do feel free to continue asking questions. I’ll try to help where I can.

Justin