I think I solved it!!! Here’s how, in case anybody else wants to do something similar:
Step 1: edit “wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js”
Step 2: Go to line #35 (/* New posts */) and simply copy and paste the the new posts section right after it (line #102)
Step 3: Change every single value that refers to ids of the original form (e.g. change #aw-whats-new-submit to #mini-aw-whats-new-submit)
Step 4: Go to the mini-post code on your template and replace the ids. Obviously you have to use the same ids as the ones you created on Step 3
To make a long story long, here’s my code:
global.js
/* MINI-POST */
/* New posts */
jq(“input#mini-aw-whats-new-submit”).click( function() {
var button = jq(this);
var form = button.parent().parent().parent().parent();
form.children().each( function() {
if ( jq.nodeName(this, “textarea”) || jq.nodeName(this, “input”) )
jq(this).attr( ‘disabled’, ‘disabled’ );
});
jq( ‘form#’ + form.attr(‘id’) + ‘ span.ajax-loader’ ).show();
/* Remove any errors */
jq(‘div.error’).remove();
button.attr(‘disabled’,’disabled’);
/* Default POST values */
var object = ”;
var item_id = jq(“#mini-whats-new-post-in”).val();
var content = jq(“textarea#mini-whats-new”).val();
/* Set object for non-profile posts */
if ( item_id > 0 ) {
object = jq(“#mini-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,
‘object’: object,
‘item_id’: item_id
},
function(response)
{
jq( ‘form#’ + form.attr(‘id’) + ‘ span.ajax-loader’ ).hide();
form.children().each( function() {
if ( jq.nodeName(this, “textarea”) || jq.nodeName(this, “input”) )
jq(this).attr( ‘disabled’, ” );
});
/* Check for errors and append if found. */
if ( response[0] + response[1] == ‘-1’ ) {
form.prepend( response.substr( 2, response.length ) );
jq( ‘form#’ + form.attr(‘id’) + ‘ div.error’).hide().fadeIn( 200 );
button.attr(“disabled”, ”);
} else {
if ( 0 == jq(“ul.activity-list”).length ) {
jq(“div.error”).slideUp(100).remove();
jq(“div#message”).slideUp(100).remove();
jq(“div.activity”).append( ‘
‘ );
}
jq(“ul.activity-list”).prepend(response);
jq(“ul.activity-list li:first”).addClass(‘new-update’);
jq(“li.new-update”).hide().slideDown( 300 );
jq(“li.new-update”).removeClass( ‘new-update’ );
jq(“textarea#mini-whats-new”).val(”);
/* Re-enable the submit button after 8 seconds. */
setTimeout( function() { button.attr(“disabled”, ”); }, 8000 );
}
});
return false;
});
/* MINI-POST */
and the form for the new “mini-post-form”
<form action=”<?php bp_activity_post_form_action() ?>” method=”post” id=”mini-whats-new-form” name=”mini-whats-new-form”>
<?php do_action( ‘bp_before_activity_post_form’ ) ?>
<textarea name=”mini-whats-new” onFocus=”this.value=”; this.onfocus=null;” id=”mini-whats-new” rows=”2″ cols=”40″>Got something to share?</textarea>
<div id=”whats-new-submit”>
<span></span>
<input type=”submit” name=”mini-aw-whats-new-submit” id=”mini-aw-whats-new-submit” value=”<?php _e( ‘Post’, ‘buddypress’ ) ?>” />
</div>
<div id=”whats-new-post-in-box”>
<?php _e( ‘Post in’, ‘buddypress’ ) ?>:
<select id=”mini-whats-new-post-in” name=”mini-whats-new-post-in”>
<option selected=”selected” value=”0″><?php _e( ‘My Profile’, ‘buddypress’ ) ?></option>
<?php if ( bp_has_groups( ‘user_id=’ . bp_loggedin_user_id() . ‘&type=alphabetical&max=100&per_page=100&populate_extras=0’ ) ) : while ( bp_groups() ) : bp_the_group(); ?>
<option value=”<?php bp_group_id() ?>”><?php bp_group_name() ?></option>
<?php endwhile; endif; ?>
</select>
</div>
<input type=”hidden” id=”mini-whats-new-post-object” name=”mini-whats-new-post-object” value=”groups” />
<?php do_action( ‘bp_activity_post_form_options’ ) ?>
<?php wp_nonce_field( ‘post_update’, ‘_wpnonce_post_update’ ); ?>
<?php do_action( ‘bp_after_activity_post_form’ ) ?>
</form><!– #mini-whats-new-form –>
<form action=”<?php bp_activity_post_form_action() ?>” method=”post” id=”mini-whats-new-form” name=”mini-whats-new-form”>
<?php do_action( ‘bp_before_activity_post_form’ ) ?>
<textarea name=”mini-whats-new” onFocus=”this.value=”; this.onfocus=null;” id=”mini-whats-new” rows=”2″ cols=”40″>Got something to share?</textarea> <div id=”whats-new-submit”> <span></span> <input type=”submit” name=”mini-aw-whats-new-submit” id=”mini-aw-whats-new-submit” value=”<?php _e( ‘Post’, ‘buddypress’ ) ?>” /> </div>
<div id=”whats-new-post-in-box”> <?php _e( ‘Post in’, ‘buddypress’ ) ?>:
<select id=”mini-whats-new-post-in” name=”mini-whats-new-post-in”> <option selected=”selected” value=”0″><?php _e( ‘My Profile’, ‘buddypress’ ) ?></option>
<?php if ( bp_has_groups( ‘user_id=’ . bp_loggedin_user_id() . ‘&type=alphabetical&max=100&per_page=100&populate_extras=0’ ) ) : while ( bp_groups() ) : bp_the_group(); ?> <option value=”<?php bp_group_id() ?>”><?php bp_group_name() ?></option> <?php endwhile; endif; ?> </select> </div> <input type=”hidden” id=”mini-whats-new-post-object” name=”mini-whats-new-post-object” value=”groups” />
<?php do_action( ‘bp_activity_post_form_options’ ) ?>
<?php wp_nonce_field( ‘post_update’, ‘_wpnonce_post_update’ ); ?> <?php do_action( ‘bp_after_activity_post_form’ ) ?>
</form><!– #mini-whats-new-form –>