Combining rtMedia privacy with the BuddyPress Activity Privacy Plugin


#1

###NOTE, not sure if I’m allowed to post things like this, so delete it if I’m not. ALSO, rtMedia in no way supports this hack. Don’t bug them about it. :slight_smile: ####

Thought I’d post this jquery code to combine the privacy settings for rtMedia and the BuddyPress Activity Privacy Plugin.

Basically what I’m doing is hiding the privacy controls for rtMedia and using the on change event on the BuddyPress Activity Privacy controls to set the appropriate reMedia selection.

jQuery(document).ready( function() {  
	jQuery('#rtSelectPrivacy').hide();  //Hide rtMedia's select control  
        jQuery("#activity-privacy").val( 'loggedin' );// Set BPAP control to rtMedia's equivalent default setting (i.e. loggedin == 'Users' in rtMedia's settings) This ensures the controls have matched selections from the beginning since BPAP doesnt have a default setting. NOTE: This assumes you have rtMedia's 'User Override' turned off.  
	jQuery('#activity-privacy').on('change', function() {  // When a user changes the BPAP setting fire off a change on the rtMedia control.  
		if (this.value == 'public') { // public -> public  
                        jQuery("#rtSelectPrivacy").val("0");  // set rtMedia to public	  
                } else if (this.value == 'loggedin') {  //loggedin-> users  
			jQuery("#rtSelectPrivacy").val("20");  //set rtMedia to Users  
		} else if (this.value == 'friends') { //friends -> friends  
			jQuery("#rtSelectPrivacy").val("40"); //set rtMedia to Friends	  
		} else if (this.value == 'onlyme' || this.value == 'adminsonly') { //onlyme or adminsonly -> private  
			jQuery("#rtSelectPrivacy").val("60");  //set rtMedia to Private  
		}  
	});  

});

#2

I’ve reworked the script again so that it will work when “user override” is set to true. AGAIN - rtMedia does not support this.

if ( typeof jq == "undefined" )  
	var jq = jQuery;  

jq(document).ready( function() {  
	jq("#rtSelectPrivacy").hide(); //hide rtMedia's select control  
	set_rtmedia_privacy(jq("#rtSelectPrivacy").val()); //get default rtMedia privacy and set BPAP control  
	jq("#activity-privacy option[value='public']").remove(); //remove public since site is locked down  
	jq("#activity-privacy option[value='adminsonly']").remove(); //remove admins only since rtMedia only uses 'private'  
	jq("#activity-privacy option[value='loggedin']").text('Everyone'); //change the name of 'Logged In' to 'Everyone'  
	jq("#activity-privacy option[value='onlyme']").text('Private'); //change the name of 'Logged In' to 'Everyone'  
	jq('#activity-privacy').on('change', function() {  
		set_rtmedia_privacy(this.value);  
	});  
	  
	function set_rtmedia_privacy ($privacy_id) {  
		if ($privacy_id == 'public' || $privacy_id == 0) { //public -> pubic (note that I've removed this option above)  
			jq("#rtSelectPrivacy").val("0");  
			jq("#activity-privacy").val("public");  
		} else if ($privacy_id == 'loggedin' || $privacy_id == 20) {  //users -> loggedin  
			jq("#rtSelectPrivacy").val("20");  
			jq("#activity-privacy").val("loggedin");  
		} else if ($privacy_id == 'friends' || $privacy_id == 40) { //friends -> friends  
			jq("#rtSelectPrivacy").val("40");	  
			jq("#activity-privacy").val("friends");	  
		} else { //private -> onlyme  
			jq("#rtSelectPrivacy").val("60");  
			jq("#activity-privacy").val("onlyme");  
		}  
	}  

});

#3

Hello,

I just want to mention that the last version of BuddyPress Activity Privacy http://wordpress.org/support/plugin/buddypress-activity-privacy ( v1.3.2 ) contain a beta integration with rtMedia.


#4