Skip to:
Content
Pages
Categories
Search
Top
Bottom

Component vs. Plugin

  • @killerbarney

    Member

    Conceptually, I am getting a bit confused as to when do I use a component and when do I just hook in my code as a plugin. Can somebody elaborate a bit into when is the proper type for you to use the skeleton component?

    Right now, it seems like anytime there is a new type of data, it would be a component. So Friends is a type of data, as is Activity and Groups etc. So if I wanted to users to list the books they read, Books would be a prime candidate for a component, is this correct?

    But what if I want to sort the activity stream differently, let’s say based on some extra parameter that I set (like how many “Up” votes), would that be something I add to my own customized theme? But then the “Up” vote functionality itself is a plugin?

    Still confused how all these pieces come together.

    Lastly, the Skeleton component is not updated to 1.5’s BP release right?

Viewing 10 replies - 1 through 10 (of 10 total)
  • @modemlooper

    Moderator

    They both should be created with plugins. A BuddyPress component is a sitewide content type that would have a directory structure, like members or groups.

    The skeleton plugin is being updated, current version on github.

    https://github.com/boonebgorges/buddypress-skeleton-component

    @killerbarney

    Member

    thanks!

    just out of curiosity, is the skeleton going to change so much that you suggest I wait for the 1.5 compatible version to come out? Or just go ahead and develop and fix the differences later. It seems like most of 1.2 stuff is at least somewhat compatible right?

    @modemlooper

    Moderator

    @killerbarney

    Member

    i got that the first time :)

    I was asking whether the skeleton was going to be updated to the new 1.5 version. Currently it’s compatible for the 1.2.9 (this is evident because some functions it’s using is deprecated in the errors). I’m not familiar with the Buddypress development process, so I’m not sure if the new skeleton will be a big change from the current version.

    @killerbarney

    Member

    and by the way, the 1.5 version of buddypress skeleton component is not in synch with the Buddypress 1.5. Their 1.5 is compatible with the 1.2.9 version.

    @modemlooper

    Moderator

    cc @boonebgorges what’s the timeline for compatibility with current BP?

    @boonebgorges

    Keymaster

    The 1.5-compatible version of the skeleton component (BPSC 1.6 – sorry for the confusing version numbers, just a bad coincidence) will be out soon, hopefully today. Until then, use the version from Github.

    I should note that the new skeleton component is not backward compatible, as it uses the new BP_Component class. If you need to maintain 1.2.x compatibility with your plugin, use the old Skeleton Component.

    @boonebgorges

    Keymaster

    And, for what it’s worth, the idea of a “component” is not one with clear demarcations. Both you and @modemlooper suggest some useful criteria:
    – if your plugin creates new data objects, it’s probably a component
    – if your plugin needs to have a top-level directory, it’s probably a component (and, in this case, a special kind of component called a “root” component.

    In BP 1.5, the idea of a “component” has a little bit more technical fleshing-out due to the BP_Component base class. A quick look at that class and its more important methods (setup_globals(), setup_nav()) will give you sense of when it’s useful to think of a plugin as a component. But again, there are no hard-and-fast rules.

    In general, when in doubt, I would suggest using the BP_Component class. Sometimes your component won’t need some parts of the component infrastructure – sounds to me like your “up vote” plugin doesn’t need dedicated navigation items, for instance – but in that case, you can just leave those methods out. Using the BP_Component class just makes your life a bit easier by hooking you into the BP load order in the appropriate places.

    @killerbarney

    Member

    thanks! I have been eagerly awaiting this new release. You are really making things come together with 1.5 :)

    @killerbarney

    Member

    when i say 1.5, i mean buddypress, not buddypress skeleton ;)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Component vs. Plugin’ is closed to new replies.
Skip to toolbar