Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • dpolant
    Participant

    @dpolant

    Interesting, I will take a look at role scoper.

    One thought I was having was to make different kinds of identifying groups, or in other words, different possibilities for relationships between a user and a group. Maybe the site admins could configure n number of these, and the bpgc widget would be a dropdown. I have been using civicrm lately and the concept of relationships seems like a very powerful one.

    Any thoughts?


    dpolant
    Participant

    @dpolant

    I believe the correct way to do this is simply to go into the template file and rearrange the order of the <select> options so that ‘Alphabetical’ is first. ajax.php has functions that allow this to work.

    for my-groups, the correct template is bp-themes/bp-default/members/single/groups.php

    for the groups directory, bp-themes/bp-default/groups/index.php


    dpolant
    Participant

    @dpolant

    The simplest way, which might disable some things you don’t want disabled, is to turn off blog tracking in the wp-admin -> buddypress -> component setup.

    To just get rid of blog posts in the activity feed, you need to remove some actions. Try this:

    remove_action( 'save_post', 'bp_blogs_record_post', 10, 2);

    Remember this needs to go in a plugin or in bp-custom.php. There are other blog related activity things too like comments and new blog creations. You can get rid of these with similar syntax – just look through bp-blogs.php and find the lines that say “add_action” and have a record function in quotes.


    dpolant
    Participant

    @dpolant

    I don’t think that bp 1.1.3 has a bp_init action, just to clarify. In fact I don’t think 1.1.3 has any do_actions that fire as the plugin is being loaded, before plugins_loaded, although I could be wrong.

    If I am correct, it means that in bp < 1.2, there is no add_action that can hook your plugin into loading classes or other code on a Buddypress load event.

    In 1.2, bp_init solves this by firing at the end of the load of the buddypress files. bp_init does not depend on any WP action to fire. If you hook into bp_init, your plugin will have instant access to all Buddypress classes and functions.

    As far as I can tell, the best way to make your groups API plugin work in BP 1.1.3 is to force BP to load at the beginning of your plugin. As to why 2.9.1 brings these issues to the forefront, I have absolutely no idea, but I have tested this as well and it definitely seems to be the culprit. There may be a performance it if you load BP this way, but I have checked and it at least does not load things twice.


    dpolant
    Participant

    @dpolant

    Try putting something like this at the beginning of the plugin: (not tested for all cases but worked for me). What screws up groups API is when BP gets loaded after the plugin and your plugin can’t find the class its supposed to extend. I have no idea why wpmu 2.9.1 brings out this issue.

    function load_buddypress() {
    //buddypress is loaded
    if ( function_exists( 'bp_core_setup_globals' ) )
    return false;

    // Get the list of active sitewide plugins
    $active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
    $bp_activated = $active_sitewide_plugins['buddypress/bp-loader.php'];

    //bp is not activated
    if ( !$bp_activated ){
    return false;
    }

    //bp is activated but not yet loaded
    if ( $bp_activated ) {
    return true;
    }

    return false;
    }

    //load bp if its activated and not loaded
    if ( load_buddypress() ){
    require_once( WP_PLUGIN_DIR . '/buddypress/bp-loader.php' );
    }

    This made it work one of my plugins. It basically forces BP to load at the beginning of your plugin. And something in WP prevents it from loading twice if it does this.


    dpolant
    Participant

    @dpolant

    Thanks andy, bp_init does the trick for my class dependencies. I suppose what I should do is create a loader.php file that loads the rest of my files on the action bp_init.

    Also just for the record the code I posted above doesn’t work in 1.2, but it shouldn’t really need to if you use the bp_init action.


    dpolant
    Participant

    @dpolant

    I just got some ajax to work in 1.2 – I’ll take a look. Where can I get the code you’re working on?


    dpolant
    Participant

    @dpolant

    I think plugins_loaded is already too late to try and load Buddypress if your plugin got loaded before it. do_action( ‘plugins_loaded comes’ ) after all plugins have been loaded, so if there is a missing class dependency, loading BP after that won’t help.

    The following code works for me:

    function bpgc_load_buddypress() {
    //buddypress is loaded
    if ( function_exists( 'bp_core_setup_globals' ) )
    return false;

    // Get the list of active sitewide plugins
    $active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
    $bp_activated = $active_sitewide_plugins['buddypress/bp-loader.php'];

    //bp is not activated
    if ( !$bp_activated ){
    return false;
    }

    //bp is activated but not yet loaded
    if ( $bp_activated ) {
    return true;
    }

    return false;
    }

    //load bp if its not activated
    if ( bpgc_load_buddypress() ){
    require_once( WP_PLUGIN_DIR . '/buddypress/bp-loader.php' );
    }

    Add this to the top of your plugin and it ought to load correctly.


    dpolant
    Participant

    @dpolant

    I am running into this same problem in 1.1.3 with the groups extension api. I found a semi-ridiculous work around – name your plugin directory something that comes after “Buddypress” in the alphabet. Does any one know a way of specifying plugin dependencies?

    Also, I never had this problem until I upgraded to mu 2.9.1. I can’t reproduce this issue on any of my pre-2.9.1 installations. On the older versions BP plugins always manage to get loaded after Buddypress.


    dpolant
    Participant

    @dpolant

    While we’re talking about the white screen of death, I am making a plugin that works fine if you activate it sitewide and gives the good old white screen when I activate it not sitewide. Any ideas in general why this might happen?

    Does any one know exactly what the white screen means, or what specifically causes it?


    dpolant
    Participant

    @dpolant

    I’ve tracked this problem down I think: wp_sanitize_redirect is stripping out @ signs …

    Override this function ( write it in bp-custom or your plugin ) if you want to use emails as usernames. Be careful, you don’t want to just comment everything out because there are security issues to worry about.


    dpolant
    Participant

    @dpolant

    Note that this ticket has been reopened because there are additional problems with this solution, like doing bp actions in which a @ sign user is the subject (edit profile, possibly others).


    dpolant
    Participant

    @dpolant

    Haha, Facebook has blocked their IP.


    dpolant
    Participant

    @dpolant

    Done. Any ideas on a quick way to patch this for a client right now?


    dpolant
    Participant

    @dpolant

    This bug is also occurring on testbp.org (right now at least).

    http://testbp.org/groups/?s=s


    dpolant
    Participant

    @dpolant

    @robertdevane

    I haven’t implemented anything that gives different admins different permission levels – but I like this idea and I will add it to the list of things to include in the next version.

    I agree with a lot of you that group taxonomy systems will complement this plugin well. Per the request of Bowe, I added in options that let you make different settings for private and public groups. I’m going to leave further taxonomical distinctions to other plugin developers I think.

    I got a little distracted during the holidays and it will be another week or so before I get this code out. Thanks for the interest, i’ll keep you all posted.


    dpolant
    Participant

    @dpolant

    Burt adsit created a plugin called bp-contents for group and member taxonomy, but it was never updated for bp 1.1 or above. I updated the group features to work in bp 1.1.2, but if I were you I would wait for the Buddypress team to add taxonomy stuff to the core (this will be better supported than my hacked bp-contents).

    Any way, I hope to have some code for you guys to test out by the end of the week :)

    PS, if any one here has experience finding security vulnerabilities, I’d like to get some other sets of eyes to make sure my plugin is completely secure.


    dpolant
    Participant

    @dpolant

    @bowe

    Right now my plugin doesn’t distinguish between different types of groups. But maybe today I will add an option that will let you enable different features in private vs public groups. The buddypress guys are working on a taxonomy system for groups that gives you more options than just private public or hidden, but that maybe a ways off. Sounds like you only need two types of groups right now anyway.

    There’s nothing that will prevent normal users from joining a group in the usual way. You can set it so that they can set the group as “identifying” (with the group name next to their name) or not.

    @mercime

    Seems like it shouldn’t have any conflicts with the privacy plugin, but I’ll have to try it out to be sure.


    dpolant
    Participant

    @dpolant

    Good call. I need to learn more about some of the things add_action can do.

    Thanks!


    dpolant
    Participant

    @dpolant

    The admin bar links are generated in the component files, like bp-groups.php, bp-wire.php, etc. Here’s how you can set the text of these links without altering the core files.

    function change_text(){
    global $bp;
    $bp->bp_nav[activity]['name'] = 'test'
    }
    add_action('wp', 'change_text');

    This sets the text of the activity link to ‘test.’ If you just want to change the name of another link, use this same function and replace ‘activity’ with the slug of the component link you want to change.

    To set other text in the nav, do a print_r on $bp->bp_nav, navigate the array and set your value. You can change link urls, position, and other things as well.

    Remember, you have to add this code to a plugin or your custom.php.


    dpolant
    Participant

    @dpolant

    Watch your escape quotes. Each time you write a double quote, it ends the previous quoted segment. If you start a quoted string with double quotes, use single quotes to indicate quotation marks inside. It works as vice versa as well.

    If you already knew that and simply wrote it all with double quotes for your demonstration, I would advise that you double check your path to your image.

    A word of advice about paths: it is usually a good idea not to hard-code the whole path. It will work on your site if you get it right, but if you ever move things it will break. Instead, use defined constants to represent these path components. WP_PLUGIN_URL points to your plugins directory, and get_option(‘siteurl’) will assume the value of your root domain, with http://. Here is a link that has some more of these useful constants.

    Hope this helps.


    dpolant
    Participant

    @dpolant

    Here is one way to do it I believe. Put this filter and function inside a plugin or your custom.php.

    add_filter('bp_blogs_activity_new_post', 'my_process', 2, 3 );

    function my_process($activity_content, $post, $post_permalink){

    $activity_content = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
    $activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content, 25 ) . "</blockquote>";

    return $activity_content;
    }

    I think this is the most efficient way of doing this. Basically, this code snippet overrides the content of the activity notification for a new blog entry. It is unfortunate that you have to write all the other crap again, but as you can see the thing you want to change (bp_create_excerpt) doesn’t have its own filter.

    The good news is, unlike some approaches to this problem, this solution doesn’t require that you alter the core.

    Try it and see if it works. Sorry ’bout the layout overflow :(


    dpolant
    Participant

    @dpolant

    I don’t think there is a bpcontents template tag that outputs an item id in the loop.

    I assume you’re trying to access this value in a place where $oci_items_template has been defined, and so I think the fastest way to get it is to call global $oci_items_template and then get $oci_items_template->item->id.

    If on the off chance you have a group_id or user_id to feed in, oci_get_member_item_id() and oci_get_group_item_id() will return (not output) an item id from a group or user id. That’s about the best I can do but I bet that’s not what you’re looking for.

    So like you said, you’re probably going to want to write your own template tag to do this.

    I tried to contact Burt about a month ago and haven’t heard back yet – I heard he might be working on a new version of bpcontents but I don’t know anything definite.

    One word of warning – at least in my case, the 1.1 upgrade totally broke down bpcontents. It wasn’t too hard to get it working again but required about half a day of debugging. If you’ve got bpcontents running in 1.1 + without hacks I’d be very interested to hear how you did it.

Viewing 23 replies - 1 through 23 (of 23 total)
Skip to toolbar