bp_activity_privacy_fix_bp_activity_plus

The BuddyPress Activity Privacy bp activity privacy fix plus function.

Description

bp_activity_privacy_fix_bp_activity_plus(); 

Usage

  1. if ( !function_exists( 'bp_activity_privacy_fix_bp_activity_plus' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-activity-privacy/includes/bp-activity-privacy-integrations.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_activity_privacy_fix_bp_activity_plus(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/bp-activity-privacy-integrations.php  
  1. function bp_activity_privacy_fix_bp_activity_plus() { 
  2. ?> 
  3. <script type="text/javascript"> 
  4.  
  5. if ( typeof jq == "undefined" ) 
  6. var jq = jQuery; 
  7.  
  8. jq(document).ready( function() { 
  9.  
  10. form = jq("#whats-new-form"); 
  11. text = form.find('textarea[name="whats-new"]'); 
  12.  
  13. //remove event handler previously attached to #bpfb_submit 
  14. try { 
  15. jq("#bpfb_submit").die( "click" ); 
  16. } catch(e) { 
  17. jq("#bpfb_submit").off( "click"); 
  18.  
  19. jq(document).delegate("#bpfb_submit", 'click', function (event) { 
  20.  
  21. event.preventDefault(); 
  22. var params = _bpfbActiveHandler.get(); 
  23. var group_id = jq('#whats-new-post-in').length ?jq('#whats-new-post-in').val() : 0; 
  24.  
  25. jq.post(ajaxurl, { 
  26. "action": "bpfb_update_activity_contents",  
  27. "data": params,  
  28. // add visibility level to the ajax post 
  29. "visibility" : jq("select#activity-privacy").val(),  
  30. "content": text.val(),  
  31. "group_id": group_id 
  32. }, function (data) { 
  33. _bpfbActiveHandler.destroy(); 
  34. text.val(''); 
  35. jq('#activity-stream').prepend(data.activity); 
  36. /** 
  37. * Handle image scaling in previews. 
  38. */ 
  39. jq(".bpfb_final_link img").each(function () { 
  40. jq(this).width(jq(this).parents('div').width()); 
  41. }); 
  42.  
  43. //reset the privacy selection 
  44. jq("select#activity-privacy option[selected]").prop('selected', true).trigger('change'); 
  45. jq('select.bp-ap-selectbox').customStyle('2'); 
  46. <?php } ?> 
  47. }); 
  48. }); 
  49. }); 
  50.  
  51. </script> 
  52. <?php