Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 476 through 500 (of 1,585 total)
  • @boonebgorges

    Keymaster

    Just to be clear, the notification function is a callback – you shouldn’t be calling it directly. Use bp_core_add_notification(). See bp-groups-notifications.php for an example of how it works.

    @boonebgorges

    Keymaster

    The reason why you’re not seeing the callback when you print is because the component class isn’t fully initialized at the time when you’re adding yourself to $bp. Try this:

    `function bp_query_subscribe_init(){
    global $bp;

    if ( !isset( $bp->query_subscribe ) ){
    $bp->query_subscribe = new BP_Query_Subscribe();
    }
    }
    add_action( ‘bp_loaded’, ‘bp_query_subscribe_init’ );

    function bp_query_test() {
    global $bp;
    var_dump( $bp->query_subscribe );
    }
    add_action( ‘bp_init’, ‘bp_query_test’, 999 );`

    As for includes, you will need to do your own manual include() for now. Don’t use BP_Component::includes().

    @boonebgorges

    Keymaster

    In BuddyPress 1.5, the parent slug for an individual group is not ‘groups’ or $bp->groups->slug. Instead, it is the single item slug (ie the group slug). Try this:
    `bp_core_remove_subnav_item( bp_get_current_group_slug(), ‘send-invites’ );`

    @boonebgorges

    Keymaster

    1) No, you don’t have to use BP_Component, but if you can, you probably should. It’s so much easier than trying to figure out which hooks to use. If you don’t need a particular method for your plugin (because it doesn’t have any navigation elements, for instance), just don’t include that method.

    2) There seems to be a bug in the way the includes() method works for plugins. For the moment, I recommend that you include your files manually.

    3) You need to call the $bp global before instantiating your class.
    `global $bp;
    $bp->query_subscribe = new BP_Query_Subscribe();`

    @boonebgorges

    Keymaster

    Change the permissions to 664 and see if it makes a difference. (You haven’t given enough info to know if 644 is ok.)

    @boonebgorges

    Keymaster

    The notifications component is not really set up to do this. Notifications get deleted after they are seen, instead of just being marked as read. There is a column called ‘is_new’, which you could probably manipulate to do what you’re trying to do, though it’d take a fair amount of fishing through the codebase to make sure that you caught every attempted deletion and replaced it with a mark-as-read. Then you’d need to create the markup for the notification history page (which would be straightforward).

    This is a pretty good suggestion for a future enhancement. I encourage you to open a ticket on trac.buddypress.org, ideally with a patch :)

    @boonebgorges

    Keymaster

    You can run as many loops as you want on a single page, as long as they’re separate. You can’t really run embedded loops (of the same content type). That’ll change when, down the road, we start using WP_Query for content loops.

    @boonebgorges

    Keymaster

    @modemlooper Yeah, that would be nice, but it’s much more complicated. Open a ticket and we can start patching :)

    @boonebgorges

    Keymaster

    Both bp_has_members() and bp_has_groups() now accept ‘exclude’ parameters. They accept a comma-separated string of group ids. bp_has_blogs() does not have an exclude parameter; feel free to open an enhancement ticket on trac.buddypress.org for this.

    @boonebgorges

    Keymaster

    Weird. I can’t reproduce on my local installations, though I’ll keep an eye out.

    @boonebgorges

    Keymaster

    I assume that @naijaping meant to link to this blog post by the same name: http://wpmu.org/are-you-ready-for-buddypress-1-5/ (it’s a nice post, by the way, and it might be considered for addition on the codex page @karmatosed)

    @boonebgorges

    Keymaster

    I would say less than a month, but more than a few days.

    To be honest, though, BP 1.5 is quite stable, and the codebase will change very little from this point on. Whatever work you’ve got to do with your plugins and client sites, you should probably get on it soon :)

    @boonebgorges

    Keymaster

    > This doesn’t have any effect, since the site where the post is saved will always equal BP_ROOT_BLOG.

    I think that’s wrong. The site where the post is saved will be the site where the post is saved. If you have an MS install with three blogs:
    1 – Boone’s Blog
    2 – Feedmymedia’s blog
    3 – Our BuddyPress community site (BP_ROOT_BLOG)

    when you publish a post on blog 1, $wpdb->blogid should equal 1, which is not the same as BP_ROOT_BLOG. Thus, your code should keep the item from being saved in the database.

    It’s possible that I’m still misunderstanding what you’re intending to do, though.

    What kinds of tests have you run on the code above? Did you do some var_dumps to make sure that the save_post hook is catching, and the function is being run? Did you see whether $wpdb->blogid actually does match BP_ROOT_BLOG in that case?

    @boonebgorges

    Keymaster

    That sounds like a bug. Could you open a ticket on trac.buddypress.org please?

    @boonebgorges

    Keymaster

    Though I should note that checking the *current* site id is probably not what you want, since that function fires from the individual sites themselves. (And the current site is always equivalent to the current site.) You may want to check $wpdb->blogid == BP_ROOT_BLOG

    @boonebgorges

    Keymaster

    > I suppose I could add a condition to the function to whitelist only the current site id

    Yes.

    @boonebgorges

    Keymaster

    Yes, it is possible to keep posts and comments from specific blogs from being posted across the network. The idea is to intercept the bp_blogs_record_post() and bp_blogs_record_comment() functions, and unhook them when necessary.

    Say, for example, you don’t want any items from blogs 4, 6, or 10 to appear in the stream. Do this:
    `function bbg_limited_blog_activity() {
    global $wpdb;

    $blacklist = array( 4, 6, 10 );

    if ( in_array( $wpdb->blogid, $blacklist ) ) {
    remove_action( ‘save_post’, ‘bp_blogs_record_post’, 10, 2 );
    }
    }
    add_action( ‘save_post’, ‘bbg_limited_blog_activity’, 5 );`

    Similarly for bp_blogs_record_comment(), which is hooked to comment_post and edit_comment.

    For a whitelist, just switch the in_array logic around.

    @boonebgorges

    Keymaster

    Do you want to share the same content on all sites? That is, do you want groups, profiles, etc to be the same across your network?

    If yes, then put the following in your wp-config.php file:
    `define( ‘BP_ENABLE_MULTIBLOG’, true );`

    If no (you want each site to have its own groups, profiles etc), try this:
    http://rml.me/i

    @boonebgorges

    Keymaster

    @anointed There is nothing in the BP UI to do this, but you *should* be able to do it by adding a piece of groupmeta:
    `groups_update_groupmeta( $group_id, ‘forum_id’, $forum_id );`

    Should be as simple as that…

    @boonebgorges

    Keymaster

    I think that BP should probably *not* be hijacking the ‘search’ slug, when a WP page has the same slug. (By “should” I mean that the catch_uri sequence is designed to do that, but that we should perhaps consider this a bug.) Might be worth a Trac ticket.

    @boonebgorges

    Keymaster

    What @djpaul said.

    Also, as for your question about migration: I would imagine that, as far as the data itself is concerned, no migration will be necessary. However, if after BP 1.6, you want to move from the one-big-forum model to the BP one-forum-per-group model, you may have to do a bit of adjustment.

    @boonebgorges

    Keymaster

    @gordielachance How are you loading the group extension? Are you using register_group_extension()? Where are you calling it? It’s probably just happening too early in the loading process.

    @boonebgorges

    Keymaster

    The code that I posted above was written for a very specific installation. It was nice of @modemlooper to make it into a plugin, but it’s not really ready to be used widely. It’s meant to be used as a model for building something specific for your own site.

    @boonebgorges

    Keymaster

    The groups extension API is meant to add a new tab to the groups interface. If by “create extra fields” you mean that you want to add additional metadata to the Group Details tab, here is some code from a client project I once did. I’ve modified it a bit to remove some custom functions. This should give you an idea of how to start.

    `add_filter( ‘groups_custom_group_fields_editable’, ‘group_details_markup’ );
    add_action( ‘groups_group_details_edited’, ‘group_details_save’ );
    add_action( ‘groups_created_group’, ‘group_details_save’ );

    function group_details_markup() {
    $group_links = groups_get_groupmeta( $bp->groups->current_group->id, ‘e2e_links’ );
    extract( $group_links );

    $group_text = groups_get_groupmeta( $bp->groups->current_group->id, ‘e2e_text’ );

    ?>

    (Type of food, etc)


    groups->current_group->id, ‘e2e_price’ ); ?>

    <option value="1" selected=”selected”>$
    <option value="2" selected=”selected”>$$
    <option value="3" selected=”selected”>$$$
    <option value="4" selected=”selected”>$$$$
    <option value="5" selected=”selected”>$$$$$

    groups->current_group->id, ‘e2e_url’ ); ?>


    <input type="text" name="group-url" id="group-url" value="” />

    groups->current_group->id, ‘e2e_url’ ); ?>


    <input type="text" name="group-phone" id="group-phone" value="” />


    <input type="text" name="group-menupages" id="group-menupages" value="” />


    <input type="text" name="group-yelp" id="group-yelp" value="” />


    <input type="text" name="group-chow" id="group-chow" value="” />


    <input type="text" name="group-everyblock" id="group-everyblock" value="” />

    <?php

    return;
    }

    function group_details_save( $group_id ) {
    global $bp, $wpdb;

    $plain_fields = array(
    ‘url’,
    ‘phone’,
    ‘text’,
    ‘price’
    );

    $links_fields = array(
    ‘menupages’ => ‘MenuPages’,
    ‘yelp’ => ‘Yelp’,
    ‘chow’ => ‘Chow’,
    ‘everyblock’ => ‘EveryBlock’
    );

    foreach( $plain_fields as $field ) {
    $key = ‘group-‘ . $field;
    if ( isset( $_POST[$key] ) ) {
    $value = $_POST[$key];
    groups_update_groupmeta( $group_id, ‘e2e_’ . $field, $value );
    }
    }

    $links = array();
    foreach( $links_fields as $fn => $name ) {
    $key = ‘group-‘ . $fn;
    if ( isset( $_POST[$key] ) ) {
    $links[$name] = $_POST[$key];
    }
    }
    groups_update_groupmeta( $group_id, ‘e2e_links’, $links );

    // Prevent null searches by entering dummy values for important meta
    if ( !groups_get_groupmeta( $group_id, ‘bpgr_rating’ ) )
    groups_update_groupmeta( $group_id, ‘bpgr_rating’, ‘null’ );

    if ( !groups_get_groupmeta( $group_id, ‘bpgr_how_many_ratings’ ) )
    groups_update_groupmeta( $group_id, ‘bpgr_how_many_ratings’, ‘null’ );

    if ( !groups_get_groupmeta( $group_id, ‘e2e_price’ ) )
    groups_update_groupmeta( $group_id, ‘e2e_price’, ‘null’ );
    }`

    @boonebgorges

    Keymaster
Viewing 25 replies - 476 through 500 (of 1,585 total)
Skip to toolbar