Download & Extend

Removing 'Description' field from OG homepage

Project:Organic groups
Version:5.x-3.1
Component:og.module
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

#1

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

Josh

#2

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.

#3

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

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

Do you think I am wrong?

#4

subscribe

#5

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

#6

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.

#7

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

<?php
function custom_module_name_enable() {
 
db_query("UPDATE {system} SET weight = '9' WHERE name = 'custom_module_name' AND type = 'module'");
}
?>

#8

Hi,

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

#9

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;
}
}
nobody click here