By Enrique.Ruiz on
Hello,
I want to make an OG group private by using a custom php code action in Rules, as I did not find an action for this purpose.
The table is og and the field og_private for the group node has to be set to 1 for the group to be private.
Rules says the variable $node_added_empresa is available.
This is the code I am trying with, unsuccessfully.
global $node_added_empresa;
$sql="UPDATE {og} SET `og_private` = '1' WHERE {og}.`nid` = "$node_added_empresa->nid";
$result = db_query($sql);Please help.
Comments
What triggers the rule? Why
What triggers the rule?
Why not just set the group settings so the group is private by default?
Because I am using OG as an
Because I am using OG as an access control system.
I am letting my users create groups, and all of them have to be automatically made private using rules.
I am new to PHP so I do not
I am new to PHP so I do not know if I am using the variable properly.
I tried with a token but it was not working. ( I save the node inmediately in rules first fot it to get a nid)
Please help.
Fixed. I failed doing it with
Fixed. I failed doing it with PHP, as I am new to it, and I didn't get much help.
So I created a new OG action called 'Make group private' based on an existing one. I included this in the og_actions module.
adding this:
and this: