Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 31 total)
  • @nicholmikey

    Participant

    So this is what happened, the plugin “Multisite User Management” has a hook that fires when you make a new user in order to automatically assign users roles to certain blogs. This all worked fine in my dev environment, but on my production site the plugin took so long that it would crash PHP during the activation process. I fixed this by disabling that plugin. Now I was left with 80+ users that were missing their xprofile data and passwords that they set, as the script crashed before it could get to that point. (no data being copied to xprofile tables). I fixed their profiles by selecting damaged users from the wp_signups table and running the code from bp-core-signup.php that was missed due to crashes.

    This code updates all users from the 20th of august to today (the date range of the problem)

    `
    <?php

    require( dirname(__FILE__) . ‘/wp-load.php’ );
    global $bp, $wp, $wpdb;

    $users = $wpdb->get_results( “SELECT * FROM wp_signups WHERE registered > ‘2011-08-22 00:00:00′”);

    $user_id = $user;

    foreach ($users as $dbuser){

    echo $dbuser->user_login . ‘
    ‘;
    $meta = unserialize($dbuser->meta);
    $user_login = $wpdb->escape($dbuser->user_login);
    $user_email = $wpdb->escape($dbuser->user_email);
    $password = wp_generate_password( 12, false );
    $user_id = username_exists($user_login);

    $user = array(‘blog_id’ => ‘0’, ‘user_id’ => $user_id, ‘password’ => $password, ‘title’ => $signup->title, ‘meta’ => $meta);

    if ( function_exists( ‘xprofile_set_field_data’ ) ) {
    if ( !empty( $user ) ) {
    $profile_field_ids = explode( ‘,’, $user );

    foreach( (array)$profile_field_ids as $field_id ) {
    $current_field = $user[“field_{$field_id}”];

    if ( !empty( $current_field ) )
    xprofile_set_field_data( $field_id, $user_id, $current_field );
    }
    }
    }

    /* Update the user_url and display_name */
    wp_update_user( array( ‘ID’ => $user_id, ‘user_url’ => bp_core_get_user_domain( $user_id, sanitize_title( $user_login ), $user_login ), ‘display_name’ => bp_core_get_user_displayname( $user_id ) ) );

    /* Add a last active entry */
    update_user_meta( $user_id, ‘last_activity’, bp_core_current_time() );

    /* Set the password on multisite installs */
    if ( bp_core_is_multisite() && !empty( $user ) )
    $wpdb->query( $wpdb->prepare( “UPDATE $wpdb->users SET user_pass = %s WHERE ID = %d”, $user, $user_id ) );

    /* Delete the total member cache */
    wp_cache_delete( ‘bp_total_member_count’, ‘bp’ );

    }

    echo ‘all done’;

    ?>
    `

    @nicholmikey

    Participant

    I see this in my server logs, may be related “

    `2011/09/01 10:20:54 [error] 26045#0: *49560 readv() failed (104: Connection reset by peer) while reading upstream, client: 10.101.63.159, server: 10.77.8.199, request: “GET /activate?key=2f3c8e6084ce8bc7 HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9119”, host: “10.77.8.199”`

    @nicholmikey

    Participant

    Well I have spent many hours testing the move from 1.0rc1 to 1.2.9 with a smaller sample of user data and it worked out fine. Some hiccups here and there but I worked it all out. This is probably more common than you think, as I understand there was a popular WordPress MU + BuddyPress1.0rc1 package back in the day.

    I spend months reworking the root theme from something compatible with 1.0rc1 to 1.2.9, and now 1.5 is announced!! I sure hope a theme that works with 1.2.9 moves easily into 1.5, I made no core changes and uses the appropriate hooks, so heres hoping.

    @nicholmikey

    Participant

    never mind, looks like it has cleaned up about 4000 sets of user tables so far, 3000 sets to go (after 5 hours)

    @nicholmikey

    Participant

    Is it not possible to enforce password strength without js?

    @nicholmikey

    Participant

    Without using js

    @nicholmikey

    Participant

    Tried this plugin and it worked ok : https://buddypress.org/community/groups/buddypress-activity-as-blog-comments/

    It did not work on sub blogs as it was making bad links for the reply, favorite, and remove favorite buttons. I type this out into my bp-custom.php file and now it all works fine :

    `//fix replying to activity streams on sub blogs
    add_filter(‘bp_get_activity_favorite_link’,’fix_activity_link’,10,2);
    add_filter(‘bp_get_activity_unfavorite_link’,’fix_activity_link’,10,2);
    add_filter(‘bp_get_activity_comment_form_action’,’fix_activity_link’,10,1);

    function fix_activity_link($link,$setting=’none’){

    $root = $_SERVER;
    $pos = strpos($link, ‘/activity/’);
    $length = strlen($link);
    $fixed_link = ‘http://&#8217; . $root . substr($link,$pos,$length);
    return $fixed_link;
    }`

    @nicholmikey

    Participant

    I can just remove displaying and entering WordPress comments, display an activity stream for only that blog, and create a text box that submits to the stream, but if there is already a proper way that integrates with WordPress I would prefer that. With my method the dashboard view would show no comments while the site view would show a stream of comments.

    @nicholmikey

    Participant

    I tried hooking into bp_get_activity_latest_update, it calls `get_user_meta( $user_id, ‘bp_latest_update’, true )` and applies that ` bp_get_activity_latest_update_excerpt` filter, but it looks like the anchor is already stripped before any filtering, straight from user_meta.

    @nicholmikey

    Participant

    Thanks,

    I tried playing with that filter, looks like the mention is stripped before it is saved to the user_metadata table. Is there a function in BP that will search text for mentions and transform them into links?

    @nicholmikey

    Participant

    Even on the test drive this happens, the mention is there after I post an update due to the ajax call, but when I reload the page the anchor tag is stripped from the mention http://testbp.org/members/nicholmikey/

    @nicholmikey

    Participant

    I feel like adding sub menu items that do things is an important feature that should be clear to use.

    @nicholmikey

    Participant

    Anyone have any ideas on how to load a template from a sub menu item?

    @nicholmikey

    Participant

    Hello, thanks for the response.

    I tried bp_setup_nav and with that the menu item does not even appear. my code is

    `

    add_action(‘wp’, ‘CubePoints_List_Menu’);
    function CubePoints_List_Menu(){

    global $bp;
    $cubepoint_link = ($bp->displayed_user->id ? $bp->displayed_user->domain : $bp->loggedin_user->domain) . $bp->cubepoint->slug . ‘/’;
    global $wp_filter;

    bp_core_new_subnav_item( array(
    ‘name’ =>’test’,
    ‘slug’ => ‘top_points’,
    ‘parent_slug’ => $bp->cubepoint->slug,
    ‘parent_url’ => $cubepoint_link,
    ‘screen_function’ => ‘top_points_screen’,
    ‘position’ => 70,
    ) );
    }

    function top_points_screen() {
    global $bp;

    add_action( ‘bp_template_title’, ‘top_points_events_title’ );
    add_action( ‘bp_template_content’, ‘top_points_events_content’ );
    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
    //bp_core_load_template( apply_filters( ‘bp_em_template_screen_one’, ’em/screen-one’ ) );
    }
    /***
    * The second argument of each of the above add_action() calls is a function that will
    * display the corresponding information. The functions are presented below:
    */
    function top_points_events_title() {
    echo ‘Top Points’;
    }

    function top_points_events_content() {
    global $bp;

    ?>

    hello world

    <?php
    }
    `

    With this the menu item shows up, if I hover over it points to the correct place, but when I click it just takes me to the home page. I have tried several variations of this code with no luck.

    @nicholmikey

    Participant

    I am having the same problem

    @nicholmikey

    Participant

    To add to the activity stream you call
    `
    bp_activity_add(array(
    ‘action’ => ‘I did something awesome’,
    ‘content’ => ‘more content heret’,
    ‘component’ => ‘your component’,
    ‘type’ => ‘activity_thing’
    ));`

    If you are calling this from a plug-in, the function that contains this call needs to be hooked into bp_init

    Here is a full description of your options from bp-activity.php
    `
    $defaults = array(
    ‘id’ => false, // Pass an existing activity ID to update an existing entry.

    ‘action’ => ”, // The activity action – e.g. “Jon Doe posted an update”
    ‘content’ => ”, // Optional: The content of the activity item e.g. “BuddyPress is awesome guys!”

    ‘component’ => false, // The name/ID of the component e.g. groups, profile, mycomponent
    ‘type’ => false, // The activity type e.g. activity_update, profile_updated
    ‘primary_link’ => ”, // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)

    ‘user_id’ => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
    ‘item_id’ => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
    ‘secondary_item_id’ => false, // Optional: A second ID used to further filter e.g. a comment_id
    ‘recorded_time’ => bp_core_current_time(), // The GMT time that this activity was recorded
    ‘hide_sitewide’ => false // Should this be hidden on the sitewide activity stream?
    );`

    @nicholmikey

    Participant

    After of hours of hair pulling that I deserve as a BP newbie, i discovered that if I hook into bp_init this works fine.

    add_action( ‘bp_init’, ‘save_your_activity’ );

    The problem was with saving things to the activity stream using bp_activity_add, the save() function in bp_activity_classes.php was putting out bad sql that was missing the table name.

    I feel much better now.

    @nicholmikey

    Participant

    So far I have tracked the problem to bp-activity-classes, in the save() function, for some reason {$bp->activity->table_name} is returning nothing so the SQL structure ends up missing a table name. Makes no sense as other plugins like bbpress uses this save() feature and works fine.

    @nicholmikey

    Participant

    Did anyone get a solution to this? I have tried several methods of adding activities to the stream with no luck.

    @nicholmikey

    Participant

    Never mind…. I’m an idiot….

    I had a series of bb_ tables but the upgrade created a series of wp_bb tables. I will just copy the data.

    Update: Copied the data, everything works fine now.

    @nicholmikey

    Participant

    Ok so for the person that googles this later, it appears to be working network wide even though I activated it only in the root site. This should activate all of the options.

    @nicholmikey

    Participant

    So it appears to work if not activated network wide, although I do want this active across the network…

    @nicholmikey

    Participant

    Never mind, this was the solution :

    body {
    padding-top: 25px;
    }

    #wp-admin-bar {
    bottom: 0 !important;
    position: fixed !important;
    top: auto !important;
    }
    #wp-admin-bar ul { /* all lists */
    bottom: 24px;
    }

    #wp-admin-bar ul li:hover ul ul, #wp-admin-bar li.sfhover ul li ul {
    left: -999em;
    bottom: auto;
    }

    @nicholmikey

    Participant

    Same problem

    @nicholmikey

    Participant

    Just updating this in case others run into the same problem. I have successfully upgraded while retaining all data using the following steps:

    Revert to a non BuddyPress theme
    Disable all MU plugins
    – Navigate to wp-content/mu-plugins/ file folder
    – remove or rename (example example.php.old) all .php files related to BuddyPress, or for plugins that call BuddyPress functionality. Leave these 2 in place :
    – Index.php
    – bp-core.php
    – Test site to ensure you have not removed a needed plugin that is not related to BuddyPress
    – Remove or rename bp-core.php
    Install BuddyPress 1.0
    – copy the unziped BuddyPress folder into the wp-content/plugins/ directory
    – Go to the network admin control panel in WordPress
    – Activate BuddyPress
    – Test site for data retention
    Upgrade to the latest BuddyPress
    – Go to the BuddyPress plugin on the plugin page
    – Click the automatic update button
    – Enable the default BuddyPress theme
    – Test site for data retention
    Upgrade Complete

    I have a custom theme to rebuild and some in house plug-ins to fix, I’ll post any important info I run into to help any other souls Google-ing this problem.

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