$node->og_theme vs. $node->theme problem when load/save a node.
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #175486. -->
Reported by: [marcp](https://www.drupal.org/user/20885)
>>>
<p>When using OG as an API instead of using Drupal's standard node edit form with OG's additions, it is necessary to copy $node->og_theme into $node->theme before saving an OG node.</p>
<p>The following two lines will unset an OG's theme:</p>
<pre>$node = node_load($gid); // Loads up $node->og_theme<br>node_save($node); // Saves $node->theme</pre><p>
This fixes the problem:</p>
<pre>$node = node_load($gid); // Loads up $node->og_theme<br>$node->theme = $node->og_theme;<br>node_save($node); // Saves $node->theme</pre><p>
It looks like this happens because og_group_form() tacks on a system_theme_select_form:</p>
<pre> $form['og_theme'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the group.'), $edit['theme'] ? $edit['theme'] : $node->og_theme, 2);;</pre><p>
I haven't tried to fix this in OG but will gladly submit a patch if this is worthy of a fix. Seems like the submission of the form should make sure that $edit['og_theme'] is populated with the value of $edit['theme'] so that og_insert_group and og_update_group can use $node->og_theme the same way og_load_group does.</p>
issue