Changing default privacy settings in BuddyPress/rtMedia.

Hello again!

So there are a couple of places in my BuddyPress site that have default privacy settings that don't really apply to the site that I'm building, and I need them changed/altered slightly. For example, the rtMedia plugin uses the following privacy options for when someone uploads media:
* Public
* Logged In Users
* Friends
* Private

The problem is...my site will be a private site, where ONLY logged in members will ever see anything anyway. So the "Public" option doesn't make sense to be there at all, and will most-likely just confuse members. I would like to remove that option somehow.
In addition, once "Public" is removed, then the "Logged in users" option makes less sense the way it's worded. I would rather this read "All Members" instead.

Is there an easy way to remove "Public" and change "Logged in Users" to "All Members" instead for rtMedia settings?

The other place is in the BuddyPress profile visibility options. Here, the wording is a bit different, and it already uses "All members" instead of "Logged in Users" which is good. (In fact, once I learn how to change the wording in rtMedia's settings, I may change ALL the options to match the BuddyPress ones for consistency).
But here, they also use "Everyone" (which is like "Public"), which is even more confusing when it doesn't apply to this site. I definitely want that removed there too!!

Any help that can be given to make these changes would be highly appreciated. THANKS!!!

  • Michelle Shull

    Hey, Anton!

    For text changes, we recommend either doing a translation, changing the plugin text to your text like you were translating from one language to another, or the easy version of that, which is using our Ultimate Branding plugin to handle the text changes site or network wide.

    For the rtMedia privacy options, this is a bit trickier. The options don't have unique IDs or classes, so there's nothing I can target with display: none, which is how we'd usually hide unwanted text.

    BUT! I did find this plugin, which recently added integration with RT media: https://wordpress.org/plugins/buddypress-activity-privacy/, it looks like allowing this plugin to handle privacy instead of RT allows you to customize the settings there, which would avoid the need to do the text change, as well.

    Let me know if you need more help here!

  • Anton

    @Michelle Shull -

    For text changes, we recommend either doing a translation, changing the plugin text to your text like you were translating from one language to another, or the easy version of that, which is using our Ultimate Branding plugin to handle the text changes site or network wide.

    I've used Ultimate Branding before, which is great. Unfortunately...it doesn't always work on text of all 3rd-party plugins, and that's definitely the case here with rtMedia. (Unless I'm using the wrong "text domain" name? I'm never quite sure what to put there...). Do you mind logging back and taking a look to see if I did it well?
    If that doesn't work, what's the best way to do a translation?

    BUT! I did find this plugin, which recently added integration with RT media: https://wordpress.org/plugins/buddypress-activity-privacy/, it looks like allowing this plugin to handle privacy instead of RT allows you to customize the settings there, which would avoid the need to do the text change, as well.

    Cool - this gives full control of what options to use in the privacy settings, which I love! Yay!
    It still uses "Logged In Users," though -- and there's no way to change that in this plugin, or with Ultimate Branding. It's not a deal-killer, but I would still love to change it to "All Members" in every instance, if possible...

    Unfortunately... a NEW problem arises from this new plugin. Now the privacy option appears TWICE (see attached -- this seems to be a theme issue, as temporarily switching to a default theme made the double option disappear). Also, I'm only able to select the first drop-down, and I can only select it when clicking on the far left portion of it. Nothing happens when I click on the majority of the drop-down -- just the left of it.
    I tried hiding the second unstyled, non-working dropdown with CSS (I had to hide the little carat too), but....then the first dropdown didn't work AT ALL when it was by itself. Not even in the far left portion of it.
    So....this plugin sounded like a cool solution, but...my theme is apparently messing things up. I'll try and ask the developers if they'd be willing to support this plugin, but they only seem to do that kind of thing if they think the plugin's popular enough, and I don't know if they'd deem this one worthy enough...
    We'll see.

    In the meantime, thanks so much for the help that you've given so far!!!

  • Michelle Shull

    Hey there!

    Okay, we can ditch that plugin, as I just found an even better solution, a function that ties right into the filter in rtMedia. They, as it turns out, have excellent developer docs.

    Add this to your functions.php file in your active theme:

    add_action( 'plugins_loaded', 'my_custom_plugin_plugins_loaded', 10 );
    
    function my_custom_plugin_plugins_loaded(){
        add_filter( 'rtmedia_privacy_levels', 'custom_rtmedia_privacy_levels', 10, 1 );
    }
    
    function custom_rtmedia_privacy_levels( $custom ) {
            $custom = array(
            'levels' => array(
                40=> '<strong>Just My Friends</strong> = Visible to friends',
                20 => '<strong>All Members</strong> - Visible to registered users',
               )
            );
        return $custom;
    }

    This will remove public and private, and only show My Friends and All Members. This eliminates the need for Ultimate Branding as well, the text can be changed right in the function.

    This should override the other privacy settings, but let me know if it does not.

    Thanks!

  • Michelle Shull

    Howdy!

    Here's the front page of the dev docs: http://docs.rtcamp.com/rtmedia/developers/index.html, and this is the specific hook we're playing with: http://docs.rtcamp.com/rtmedia/developers/hooks/rtmedia-hooks/filter-to-modify-default-privacy-options.html

    I made a typo above! That may be what went wrong here.

    Change this line:

    40=> 'Just My Friends = Visible to friends',

    to this:

    40 => 'Just My Friends - Visible to friends',

    And cross your fingers, legs, and eyes before you hit save. Maybe toss a little salt over your shoulder or knock wood, as well. :wink:

  • Anton

    @Michelle Shull -

    Here's the front page of the dev docs:

    Oooooooohhhh, this is going to be REALLY helpful. :wink:
    Although I'll need a better understanding of what all of this means. For example....

    this is the specific hook we're playing with:

    In the example on that page, the array options used "20" and "0," and you used "40" and "20." I get that the different numbers correspond to the different privacy options, but how does one know which number to use? For example, if I wanted to also include the "Private" option, what number would I add?

    I made a typo above! That may be what went wrong here.

    Change this line:

    40=> 'Just My Friends = Visible to friends',

    to this:

    40 => 'Just My Friends - Visible to friends',

    And cross your fingers, legs, and eyes before you hit save. Maybe toss a little salt over your shoulder or knock wood, as well. :wink:

    I did all of the above (it was a bit hard to toss the salt and knock on wood with everything crossed!), but...alas, it still didn't work. I was about to have major sad face, but then I realized while perusing some more of rtMedia's documentation, that some examples specifically said the code would only work as a must-use plugin. Even though this example didn't say that, I decided to try it as a MUP (is that a word, because it should be) anyway, and....it worked!!! Woo hoo!!

    Thanks so much again. :slight_smile:

  • Michelle Shull

    HOT DIGGITY DOG!

    That was going to be my next suggestion, good detective work there, kind sir!

    I found the number that corresponded to the privacy setting by looking at the original dropdown in the dev console. (Right click the dropdown, choose "Inspect element." The source code that appears in the panel listed each option with a number value, I used my detective skills to figure that out, and confirmed with the privacy options settings in the dev docs that I was on the right track.) If you still have an example of the original dropdown, you should be able to get the Private value. 0 is public, IIRC 60 was private, but check behind me. (I don't have rtMedia on hand to test with, so I'm flying just a little blind.)

    Let me know if this works, and CONGRATS on getting the main dealio going. :slight_smile:

  • Anton

    @Michelle Shull -

    That was going to be my next suggestion, good detective work there, kind sir!

    ::::tips hat::::

    I found the number that corresponded to the privacy setting by looking at the original dropdown in the dev console. (Right click the dropdown, choose "Inspect element." The source code that appears in the panel listed each option with a number value, I used my detective skills to figure that out, and confirmed with the privacy options settings in the dev docs that I was on the right track.) If you still have an example of the original dropdown, you should be able to get the Private value. 0 is public, IIRC 60 was private, but check behind me. (I don't have rtMedia on hand to test with, so I'm flying just a little blind.)

    Excellent detective work yourself! I gotta remember that trick...
    And yes, 60 => 'Private' was the correct number to use!!

    One last question, I promise - and then I promise I'll mark this resolved.
    I have about four must-use plugins happening now, and may add more. Is this ok? Should I be combining them all as one massive plugin specific to my site? Or does it not really matter? Just curious.....

  • Michelle Shull

    Hello!

    You can have as many MU plugins as you need. They load before your other plugins, so if there are a bunch, it can slow things down just a tiny bit, but with four or a few more than four, you shouldn't see any issue. MU plugins are usually pretty small, it doesn't take many resources at all to parse a few lines. You can combine them, if you really want to, but they may be easier to keep track off if they're all their own plugins.

    Go forth and make your site awesome, I think you're ready to go!

  • Anton

    @Michelle Shull

    You can have as many MU plugins as you need. They load before your other plugins, so if there are a bunch, it can slow things down just a tiny bit, but with four or a few more than four, you shouldn't see any issue. MU plugins are usually pretty small, it doesn't take many resources at all to parse a few lines. You can combine them, if you really want to, but they may be easier to keep track off if they're all their own plugins.

    Good to know! I'll keep them separate for now, and will only consider combining them if I get a ridiculous amount of them over time....

    Go forth and make your site awesome, I think you're ready to go!

    Thanks! I have a looooooooooooooooooooong way to go before this site is fully ready, but I'm happy that I'm solving a lot of issues one by one here, with the help of you and the other WPMUDEV guys!!
    :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.