Add custom fields to activity stream
- 
		I’d like to add fields to the activity stream. I’m a relatively new coder so any help would be appreciated. I have studied this post and copied it to a tee but can’t seem to get it to work properly. What I am looking to do is to have 6 fields to every activity post: Post Title; Description; Make; Price; Model; and Location. I have added the fields to the form in the post-form.php as so. ` 
 @
 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="” />` It looks great. Next I added this to my functions. `/** 
 * This captures additional info at update.
 */
 function add_equipmentmeta_to_activity( $content, $user_id, $activity_id ) {
 bp_activity_update_meta( $activity_id, ‘equip’, ($_POST) );
 }add_action( ‘bp_activity_posted_update’, ‘add_equipmentmeta_to_activity’, 10, 3 ); function my_equipmentmeta() { 
 $my_equipmentmeta = bp_activity_get_meta( bp_get_activity_id(), ‘equip’ );
 //if (is_user_logged_in()) : {
 echo ‘(‘ . $my_equipmentmeta . ‘)‘;
 //}
 //endif;
 }
 add_action( ‘bp_activity_entry_meta’, ‘my_equipmentmeta’ );`Which was based on the previous post I mentioned above. I have been testing the ‘add_post_model’ to see if I could get just one to work. Lastly I changed the global.js like this. `/* Default POST values */ 
 var object = ”;
 var item_id = jq(“#whats-new-post-in”).val();
 var content = jq(“textarea#whats-new”).val();
 var title = jq(“input#add_post_title”).val();
 var make = jq(“input#add_post_make”).val();
 var model = jq(“input#add_post_model”).val();
 var price = jq(“input#add_post_price”).val();
 var location = jq(“input#add_post_location”).val();/* Set object for non-profile posts */ 
 if ( item_id > 0 ) {
 object = jq(“#whats-new-post-object”).val();
 }jq.post( ajaxurl, { 
 action: ‘post_update’,
 ‘cookie’: encodeURIComponent(document.cookie),
 ‘_wpnonce_post_update’: jq(“input#_wpnonce_post_update”).val(),
 ‘content’: content,
 ‘title’: title,
 ‘make’: make,
 ‘model’: model,
 ‘price’: price,
 ‘location’: location,
 ‘object’: object,
 ‘item_id’: item_id
 },
 `I do not get any errors but I cannot get any data to show up. The holder for the meta tags shows up but it doesn’t contain any data. I’m not entirely sure where I am going wrong. Is this the best solution for my problem or is there something else I am missing? Thanks ahead of time for any help… 
- The topic ‘Add custom fields to activity stream’ is closed to new replies.