I would like to be able to set a global setting for the access control default setting.

I would also like a global setting to show or hide the access control box, so that users would not have the ability to change the setting.

Example: right now, the default setting is to allow open access, and users have to manually set it if they want to only display it to their friends. I want to be able to switch that on my site so that it defaults to restricting access to only friends. In addition, I want to be able to hide the access control setting, so all nodes are always restricted to view only by friends.

Comments

sirkitree’s picture

How do you propose exposing these settings?

shawn dearmond’s picture

Status: Active » Needs work
StatusFileSize
new2.64 KB

Here's a patch.

It puts the checkboxes in admin/structure/flags/manage/friend.

However, the way I did it was to save the settings as variables. It works, but I'm thinking there's a better way by storing it in the cached flag object itself.

shawn dearmond’s picture

Argh! I can't figure out how to add more properties to the $flag object and have them stick. I think it has something to do with adding more stuff to $flag->options(), but I can't figure it out.

sirkitree’s picture

Yea, I think we'd have to a get a little Object Oriented for this.

something like:

class flag_friend extends flag_user {
  function options() {
    $options = parent::options();
    $options += array(
      ... our options here ...

but that's totally pseudo code and I've not written much OOP stuff myself, though I understand it in practice.

Maybe post what you've gotten so far in a code block and we can brainstorm a bit?

shawn dearmond’s picture

What I've done so far is in patch #2. But it just uses system variables, which I think is a little kludgy. I thought about building a child class, but wouldn't that result in rewriting much of the original module?

moonray’s picture

Status: Needs work » Needs review

You would probably need to alter the flag module (not just flag_friend).
Considering that, I would say the patch in #2 is the way to go.