Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • @jotem

    Participant

    You could try the following:

    global $bp;
    if($bp->current_component == BP_XPROFILE_SLUG){
    //Your code here
    }

    @jotem

    Participant

    You should use the search-function in the forum before asking… We already solved this issue here: https://buddypress.org/forums/topic/two-questions-about-the-login-process#post-8380

    That should work for you

    @jotem

    Participant

    @Mariusooms Thanks for the hint, worked for me.


    @Mattlay
    The album plugin didn’t work on my current BP installation (1.0.2 and some customizations), but works fine on a clean BP 1.0.3 install.

    @jotem

    Participant

    @cozzie Well, you could implement some sort of filter. Every activity has a certain component_name and a component_action (e.g. ‘groups’ and ‘new_wire_post’) that can be accessed like the ‘user_id’ property in the above examples.

    @ Gpo1 I’m going to check that, already thought about it…

    @jotem

    Participant

    OK, I took a quick look at BP 1.0.3 and it should work like this:

    In bp-activity-classes.php add

    $activities_formatted[$i]['user_id'] = $activities[$i]->user_id;

    just as described above.

    In bp-activity-widgets.php search for the line

    <?php echo apply_filters( 'bp_get_activity_content', bp_activity_content_filter( $item['content'], $item['date_recorded'], '', true, false, true ) ); ?>

    and change it to

    <?php echo bp_core_get_avatar($item['user_id']) . apply_filters( 'bp_get_activity_content', bp_activity_content_filter( $item['content'], $item['date_recorded'], '', true, false, true ) ); ?>

    You don’t need the other changes described in my previous posts, so just roll them back.

    @jotem

    Participant

    In bp-activity-classes.php try to add this line of code to the get_activity_for_user() function (There are a couple of very similar code lines, just add it after those)

    $activities_formatted[$i]['user_id'] = $activities[$i]->user_id;

    Also I just recognized that the hackdescribed in this thread won’t work in BP 1.0.3 as there were some core changes.

    @jotem

    Participant

    It’s not that hard to add user avatars to the activity stream, but it involves core-hacking. So as always, be warned that you won’t be able to update your BP automatically after changing core funcionality.

    This takes place in bp-activity-templatetags.php

    This is what your could should look like at the moment:

    function bp_get_activity_content() {
    global $activities_template, $allowed_tags;

    if ( bp_is_home() && $activities_template->activity_type == 'personal' ) {
    $content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name );
    } else {
    $activities_template->activity->content = bp_activity_insert_time_since( $activities_template->activity->content, $activities_template->activity->date_recorded );
    $content = $activities_template->activity->content;
    }

    return apply_filters( 'bp_get_activity_content', $content );
    }

    You’ll have to add these two lines of code at the end of the else-part

    $content = bp_core_get_avatar($activities_template->activity->user_id) . $content;
    return $content;

    The first line adds the avatar-image, the second line returns the content.

    Second line is necessary because the

    return apply_filters( 'bp_get_activity_content', $content );

    in the last line of the function filters out any images.

    Remember: The BP-Devs had something in mind when implementing this functionality, so you may encounter security-risks…

    @jotem

    Participant

    Ok, I fired up the debugger to see what could be the problem. Here’s what I found: The problem occurs only if you’re using a translated BP and is caused by the last line of code (bp-xprofile.php):

    // Concatenate the values.
    $date_value = $_POST['field_' . $group->fields[$j]->id . '_day'] . $_POST['field_' . $group->fields[$j]->id . '_month'] . $_POST['field_' . $group->fields[$j]->id . '_year'];

    // Turn the concatenated value into a timestamp
    $profile_data->value = strtotime($date_value);

    strtotime() expects a date in english language (e.g. 2February2008), but in the translated BP version the month is also translated (e.g. 2Februar2008).

    @jotem

    Participant

    Same problem here: When entering a date and hitting ‘save’ it doesn’t get saved. There’s no entry in the DB table.

    When I manually add an entry to the DB table, the profile shows the correct date (June 19, 2009). When editing the profile the date field only shows the day and year, the month is missing.

    I’m running BP 1.0.1 and WPMU 2.7.1.

    Has anyone a solution for that problem?

    @jotem

    Participant

    You’ll have to declare $bp as a global variable in your function, so you can access it in your function.

    global $bp;

    echo $bp->displayed_user->id; //Should work fine

    @jotem

    Participant

    You’ll have to edit the css-file in your member-theme.

    In the css/base.css file you’ll find something like this:

    li a#user-settings, li a#my-settings {

    background: url(../images/settings_bullet.gif) 88% 52% no-repeat;

    }

    Just copy that and change the “a#user-settings” to whatever fits your component, like “a#the-navigation-slug”. Don’t forget to put your image in the according folder and changing the name in the code to that name.

    @jotem

    Participant

    I just found what I need: The events-component (https://buddypress.org/forums/topic.php?id=1333) should be a good example to start with.

    @jotem

    Participant

    Normally you access your plugins in the members area, like ‘Profile’, ‘Messages’, ‘Settings’, ‘your-custom-component’, e.g. http://domain.tld/members/admin/your-custom-component.

    I want to create a component that’s not related to the members area and can be accessed like http://domain.tld/your-custom-component.

    Can I do this using the BP plugin system, or do I have to write a WordPress Plugin?

    @jotem

    Participant

    There’s a small function floating around in the forum that should help you:

    function oci_login_redirect($redirect_to, $set_for, $user){
    $redirect_to = bp_core_get_userurl($user->id);
    return $redirect_to;
    }
    add_filter('login_redirect', 'oci_login_redirect', 10, 3);

    Just put that in your mu-plugins/bp-custom.php.

    Credits goes to burtadsit.

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