Skip to:
Content
Pages
Categories
Search
Top
Bottom

BuddyPress 101: bp-test, Building Block For BP Component

  • Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    I would like to throw this here before I throw this on my blog, make sure someone else can duplicate this working. I didn’t put this into plugins because this actually doesn’t *DO* anything.

    http://davidbisset.com/wp-content/uploads/2008/12/bp-test.zip


    bp-test – building block for BuddyPress components

    v0.1 – 12/24/08 12:05pm EST

    David Bisset

    http://www.davidbisset.com

    http://www.dimensionmedia.com

    twitter.com/dimensionmedia

    WHAT THIS IS:

    Basically this should be the minimum required to give you the ability to add a new menu item, with two sub pages, to an already-working BuddyPress install with the beta components. This is meant for you to LEARN and possibly use as a starting building block for your BuddyPress components.

    LEGAL CRAP:

    Use At Your OWn Risk. Don’t blame me if it doesn’t work, although i’m open to making this the best way to start off building for BuddyPress (hey, that’s a great title for a book – it’s mine! copyrighting right now!).

    HOW-TO:

    You should be able to tell this Basically drop the mu-plugins right into the folder. You don’t even technically need the bp-test folder – the bp-test.php file in the mu-plugins is enough, but not useful for learning purposes. Don’t forget the member-themes files.

    SUPPORT:

    Post on my blog (davidbisset.com) or BuddyPress forums so that all can share.

Viewing 18 replies - 1 through 18 (of 18 total)
  • Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    David,

    “…minimum required to give you the ability to add a new menu item…”

    You talking about adding a new menu item to the buddybar ™ :) or to the user/options bar in the member theme?

    Avatar of Mike Pratt
    Mike Pratt
    Participant

    @mikepratt

    David – Love where you’re heading with this. When you say “menu” do you mean Admin bar or the Home/Blog/Members/Etc menus in the BP header. I hacked the latter but would much rather do it thru a plugin such as you’ve developed

    Avatar of Mike Pratt
    Mike Pratt
    Participant

    @mikepratt

    Oops. Sorry Burt. Failed to refresh as I was replying.

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    Adding a new menu item to the member theme, NOT the top bar. I did this with my recent example of “social” (view the screenshots):

    http://www.davidbisset.com/2008/12/23/buddypress-adding-twitter-and-friendfeed/

    This is a clean slate version of that above, if that makes sense.

    EDIT: Duh. This actually DOES BOTH. This will add the same menu item in “my account” WITH submenu navigation in the grey “BuddyPress” bar that is present on the top page when you login.

    Avatar of Nicola Greco
    nicolagreco
    Participant

    @nicolagreco

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    Great Nic. I’m developing another version of this that expands on the navigation.

    Remember that this isn’t really a plugin, more like a starting point FOR a plugin.

    Avatar of Nicola Greco
    nicolagreco
    Participant

    @nicolagreco

    @dimensionmedia, i’m working for aggregator, here a picture: http://img385.imageshack.us/img385/6578/aggregatorlg7.jpg

    i think tomorrow i will release basic code ;)

    nice, very nice. thank you david

    eh .. there’s a bug in buddypress, when you’re on the main page, “Test” is missing from the admin bar. If you enter a member page, it’s there. I’ve reported this in ticket #283

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    Pers,

    What exactly do you mean by “main page”? I am on the main page of my BP site and i still see the “test” in the dropdown “my account” in the top bar. I am logged in, though. Screenshots would be helpful.

    Just want to confirm to determine perhaps if it’s MY code or truly a BP bug.

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    UPDATE: This trumps the first version of bp-test mentioned above.

    Basically I have created three versions of bp-test which allows one to learn and hopefully start building BP components. Here is a blog post with screencaps:

    http://www.davidbisset.com/2008/12/25/buddypress-building-your-own-components-with-these-building-blocks/

    For those impatient, here are the links:

    http://www.davidbisset.com/wp-content/uploads/2008/12/bp-testv0-1-0.zip

    http://www.davidbisset.com/wp-content/uploads/2008/12/bp-testv0-1-1.zip

    http://www.davidbisset.com/wp-content/uploads/2008/12/bp-testv0-1-2.zip

    Version 0.1.0:

    This version is very close to the proof of concept screenshots for Twitter and Friendfeed. Very basic – it just adds a menu and two submenus to that menu. It should automatically also add the menu to the “BuddyPress Bar” that appears at the top and (by default) is grey.

    Version 0.1.1:

    This version adds the “header tab” navigation you see in the screenshot on my blog. This requires a few additional PHP functions, and therefore increases the complexity a little bit. I also added a few BuddyPress PHP functions in the sample page that you should become familiar with but are very straightforward. This version rounds out how to create major navigational elements in BuddyPress.

    Version 0.1.2:

    This (final?) version changes the “Second Page” into an example of showing rowed results (similar to what you see on the wire page). This bumps up the complexity a bit since we use alot more PHP functions, mostly stored in the bp-test-templatetags.php file. We also use several classes seen in bp-test-classes.php and bp-test-templatetags.php. Also add a “standard” (of sorts) filter file (bp-test-filters.php). If you are planning on displaying anything in a table/row format like in the screenshot above, then you will want to examine this version. I have removed AJAX references to make it easier. Honestly this is all very close to the WIRE BuddyPress component so if you want to look at that as well, especially if you have the hang of this and just need to add in AJAX, that would be a wise move.

    These three versions support potential BuddyPress components ranging from the very simple to more-or-less the level of some of the current BuddyPress beta components. These building blocks will hopefully be a learning tool first (if you don’t understand what they do, then you won’t get very far) and a time saver second.

    Avatar of Nicola Greco
    nicolagreco
    Participant

    @nicolagreco

    I think that you don’t need using page to add in your member theme :S look plugin-template.php

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    @Nic. Unfort. i’m guessing what you are saying. It’s not clear, but i realize english is not your first language. The examples above include how to simply modify the existing BuddyPress theme. Plugin-template is actually a nice starting point, I just added more to my examples. Thanks for the feedback.

    sorry, my bad .. I created “the bug”

    Avatar of Nicola Greco
    nicolagreco
    Participant

    @nicolagreco

    @dimensionmedia,

    I’m sorry. So, i think that you don’t need add files in /member-theme/ because you can write your plugin without adding files in /member-theme/ for example you can write:

    function test_page_settings() {
    global $current_user, $bp_settings_updated, $pass_error;
    add_action( 'bp_template_title', 'test_page_title' );
    add_action( 'bp_template_content', 'test_page_content' );
    add_action( 'bp_template_content_header', 'test_page_tabs' );
    bp_catch_uri('plugin-template');
    }
    function test_page_title() {
    _e( 'Hello title', 'buddypress' );
    }
    function test_page_content() {
    global $bp, $current_user, $bp_settings_updated, $pass_error; ?>
    <p>Hello Content</p>
    <?php

    function test_page_tabs() {
    global $bp, $create_group_step, $completed_to_step;
    ?>
    <ul class="content-header-nav">
    <li>Hello Tabs</li>
    </ul>
    <?php } ?>

    With that you don’t need to add page in /member-theme/. I think that users that install a plugins want only add files on mu-plugins/.

    Think if i’ve another member-theme that isn’t like the default, and i would like add this plugin..

    I hope i explain well now ;)

    Avatar of Nicola Greco
    nicolagreco
    Participant

    @nicolagreco

    UPDATED, i wrote an example plugin that works without adding files in member-theme ;)

    You can find a small post here http://buddypressdev.org/forums/topic.php?id=7

    That explain a bit about this example extending component that i called bpdev-example

    I forgot, here you can download bpdev-example : http://buddypressdev.org/plugins/bpdev-example

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    Due to the holidays over here, i haven’t had a chance to look at this but if it works well done. BTW, I tried the link on your .org site first and got a 404.

    There is more than one way to skin a cat – in fact your example is very close to the v.0.1.0 example i created a few days back. Both of these work for VERY simple components. Nice to see a slightly different execution. The more ways we can show this, the faster people will learn. Good job!

    Avatar of Nicola Greco
    nicolagreco
    Participant

    @nicolagreco

    both the first and the second link works well.. try download it directly here http://buddypressdev.org/download/3

Viewing 18 replies - 1 through 18 (of 18 total)

The topic ‘BuddyPress 101: bp-test, Building Block For BP Component’ is closed to new replies.