BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 66

    Hi Brajesh,

    Assuming the function is correctly written and unique, are the numbers really necessary? Do they just help in the case of potentially competing functions, or do they pass useful information anyway? (The answer to this one may go over my head.) And most importantly, can the wrong number break an otherwise sound function?

  • Participant
    Level: Enlightened
    Posts: 66

    Oh, I forgot to mention: it works perfectly. Thanks Brajesh, you’re a champion!

  • Participant
    Level: Enlightened
    Posts: 66

    Oops, I made a mistake in my question! I meant the default activity tab, but your code allowed me to figure it out anyway:

    
    function buddydev_custom_redirect() {
    	if ( bp_is_user_activity() && bp_is_current_action( 'mentions' ) ) {
    		$redirect_to = ( bp_core_get_user_domain( bp_displayed_user_id() ) . bp_get_activity_slug() . '/' );
    		bp_core_redirect( $redirect_to );
     	}
     }
     add_action( 'bp_actions', 'buddydev_custom_redirect', 0 );
    

    One thing I’ve always wondered: why do some functions have a number at the end? What does it do?

  • Participant
    Level: Enlightened
    Posts: 66

    No problem Brajesh – I can see you have a lot on your plate. 🙂

  • Participant
    Level: Enlightened
    Posts: 66

    Hi again Brajesh,

    I’ve been giving this some thought, and I think maybe the easiest way to do it would be to leverage BuddyPress Activity Privacy’s Activity Plus integration code to insert Activity As Wire’s posting function. However, the above code is implemented in JavaScript. Can you tell me how I could insert Activity As Wire’s PHP posting function into this?

  • Participant
    Level: Enlightened
    Posts: 66

    Hi again Brajesh.

    Here’s some code that will probably help a lot – the BuddyPress Activity Privacy plug-in has a function to work around Activity Plus’ oddities. Here’s the code it uses (I hope back ticks preserve the code):

    
    if( function_exists('bpfb_plugin_init') ) {
    
    	add_action( 'wp_footer', 'bp_activity_privacy_fix_bp_activity_plus' );
    	function bp_activity_privacy_fix_bp_activity_plus() {
    	?>
    	<script type="text/javascript">
    
    	if ( typeof jq == "undefined" )
    		var jq = jQuery;
    
    	jq(document).ready( function() {
    
    		form = jq("#whats-new-form");
    		text = form.find('textarea[name="whats-new"]');
    
    		//remove event handler previously attached to #bpfb_submit
    		jq("#bpfb_submit").die( "click" );
    
    		jq(document).delegate("#bpfb_submit", 'click', function (event) {
    
    			event.preventDefault();
    			var params = _bpfbActiveHandler.get();
    			var group_id = jq('#whats-new-post-in').length ?jq('#whats-new-post-in').val() : 0;
    			
    			jq.post(ajaxurl, {
    				"action": "bpfb_update_activity_contents", 
    				"data": params, 
    				// add visibility level to the ajax post
    				"visibility" : jq("select#activity-privacy").val(),
    				"content": text.val(), 
    				"group_id": group_id
    			}, function (data) {
    				_bpfbActiveHandler.destroy();
    				text.val('');
    				jq('#activity-stream').prepend(data.activity);
    				/**
    				 * Handle image scaling in previews.
    				 */
    				jq(".bpfb_final_link img").each(function () {
    					jq(this).width(jq(this).parents('div').width());
    				});
    
    				//reset the privacy selection
    				jq("select#activity-privacy option[selected]").prop('selected', true).trigger('change');
    
    				jq('select.bp-ap-selectbox').customStyle('2');
    			});
    		});
    	});
    
    	</script>
    	<?php 
    	}
    
    }
    
  • Participant
    Level: Enlightened
    Posts: 66
    ljmac on in reply to: [Resolved] Spam In FB-Like Activity Stream #4421

    Thanks for the rapid fix in 1.1.7 Brajesh

  • Participant
    Level: Enlightened
    Posts: 66

    Hi Brajesh,

    Yes, having looked at the code myself I can see it won’t be simple – Activity Plus is a very capable plug-in, but very non-standard. I should have mentioned that if it’s easier for me to hack Activity Plus itself, I’m happy to do that too.

    Whatever the case, I greatly appreciate your help anyway.

  • Participant
    Level: Enlightened
    Posts: 66

    I confirm that friends plus following support now works out of the box, and there are no errors with BP 1.8. Thank you so much Brajesh!

  • Participant
    Level: Enlightened
    Posts: 66

    Thanks Brajesh, that’s totally awesome! Thanks for keeping this release BP 1.8 compatible. 🙂