[buddypress-trac] [BuddyPress Trac] #6569: Let's give	post-form.php the love
    buddypress-trac 
    noreply at wordpress.org
       
    Fri Aug  7 05:37:07 UTC 2015
    
    
  
#6569: Let's give post-form.php the love
----------------------------------------+------------------
 Reporter:  modemlooper                 |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  2.4
Component:  Appearance - Template Pack  |     Version:  1.2
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch                   |
----------------------------------------+------------------
Comment (by r-a-y):
 > That hook is not in the patch
 The `'bp_activity_after_save'` hook is not a new hook:
 https://buddypress.trac.wordpress.org/browser/tags/2.3.2/src/bp-
 activity/classes/class-bp-activity-activity.php#L246
 What I am saying is the `'bp_activity_add'` hook is not necessary when you
 have the `'bp_activity_after_save'` hook, which passes the full activity
 object when an activity item is saved into the database.
 The following code snippet should work:
 {{{
 function my_activity_custom_post_save( $activity ) {
      if ( ! empty( $_POST['YOUR_FORM_VAR'] ) ) {
           bp_activity_update_meta( $activity->ID, 'key',
 $_POST['YOUR_FORM_VAR'] );
      }
 }
 add_action( 'bp_activity_after_save', 'my_activity_custom_post_save' );
 }}}
 The reason why this works is imath's patch passes all the form fields from
 the activity post form during AJAX, which should allow you to check the
 `$_POST` global for your form field value.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6569#comment:21>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
    
    
More information about the buddypress-trac
mailing list