What the title says...

I have managed to remove group website by commenting out lines of code (I understand this is a new feature in the latest release). But can I do the same for the Description Field? My homepage node type already has a 'title' which suffices.

Comments

joshua_cohen’s picture

This can be done with hook_form_alter using unset($form['og_description']); There is no need to alter the OG module.

Josh

najibx’s picture

How about leave blank in "Body field label:"

It says ....To omit the body field for this content type, remove any text and leave this field blank.

David Stosik’s picture

Hello,
joshua_cohen > I didn't manage to remove "Description" field using hook_form_alter.

  function custom_form_alter($form_id, &$form) {
    unset($form['og_description']);
  }

Do you think I am wrong?

amitaibu’s picture

subscribe

lias’s picture

Did you stick this in your template.php file and did it work? I'm trying to accomplish the same thing. Thanks.

edit:
tried the code:

/** remove og_description **/
  function phptemplate_hook_form_alter($form_id, &$form) {
    unset($form['og_description']);
  }

/**and**/

/** remove og_description **/
  function phptemplate_form_alter($form_id, &$form) {
    unset($form['og_description']);
  }

neither worked to remove og_description from form

Hanno’s picture

hook_form_alter didnt work for me, but I discovered that you had to set the module weight of your module lower than the module of organic groups to unset og_description successfully. I changed this to '2' by the module http://drupal.org/project/moduleweight.
There is also the module autofill og description, same issue with module weights.

glennnz’s picture

Another way to change the module weight is using this in your module:

function custom_module_name_enable() {
  db_query("UPDATE {system} SET weight = '9' WHERE name = 'custom_module_name' AND type = 'module'");
}
koffih’s picture

Hi,

Whats the right way to unset or autofil og_description on D6 please?

bdawg8569’s picture

The same strategy applies to drupal 6. I was able to get rid of it by creating a small custom module that used a hook_form_alter to unset the og_description field. As noted in the posts above, if your module weight is not set below OG, it won't work. I assume this is because the OG module is using its own hook_form_alter to add the field, so if your code is executed first, the field isn't there yet.

this worked for me AFTER i made sure my module weight was less than that of OG. My module was called "modify".

function modify_form_alter(&$form, $form_state, $form_id)
{
	switch($form_id)
	{
		case 'coalition_node_form':
			unset($form['og_description']);
		  	break;
	}
}