Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/27/2014 07:51:28 PM (12 years ago)
Author:
boonebgorges
Message:

Reinstate updated_profile activity item

Once upon a time, a user's activity stream was updated when that user updated
his/her profile. This changeset reintroduces (and rethinks) that functionality.

  • New phrasing is "Boone's profile was updated", to avoid gendered pronouns in English
  • updated_profile items are limited to one per user per two-hour period
  • Activity items are posted only when at least one publicly-visible xprofile field has been changed

Fixes #4636

Props ericlewis, boonebgorges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-screens.php

    r7960 r7998  
    103103
    104104            // Now we've checked for required fields, lets save the values.
     105            $old_values = $new_values = array();
    105106            foreach ( (array) $posted_field_ids as $field_id ) {
    106107
     
    121122                $visibility_level = !empty( $_POST['field_' . $field_id . '_visibility'] ) ? $_POST['field_' . $field_id . '_visibility'] : 'public';
    122123                xprofile_set_field_visibility_level( $field_id, bp_displayed_user_id(), $visibility_level );
    123             }
    124 
    125             do_action( 'xprofile_updated_profile', bp_displayed_user_id(), $posted_field_ids, $errors );
     124
     125                // Save the old and new values. They will be
     126                // passed to the filter and used to determine
     127                // whether an activity item should be posted
     128                $old_values[ $field_id ] = array(
     129                    'value'      => xprofile_get_field_data( $field_id, bp_displayed_user_id() ),
     130                    'visibility' => xprofile_get_field_visibility_level( $field_id, bp_displayed_user_id() ),
     131                );
     132                $new_values[ $field_id ] = array(
     133                    'value'      => $value,
     134                    'visibility' => $visibility_level,
     135                );
     136            }
     137
     138            do_action( 'xprofile_updated_profile', bp_displayed_user_id(), $posted_field_ids, $errors, $old_values, $new_values );
    126139
    127140            // Set the feedback messages
Note: See TracChangeset for help on using the changeset viewer.