Hi,

I'm using Footheme as a subtheme of Sky & generally, everything works great.

I'm trying to use a theme_preprocess_node() function to change the submitted text from the default set by AT. This is the function:

function mytheme_preprocess_node(&$vars) {
  if (variable_get('node_submitted_' . $vars['node']->type, TRUE)) {
    $vars['submitted'] = t('By !username on !datetime',
      array(
        '!username' => $vars['name'],
        '!datetime' => date('j/n/y',$vars['changed']),
      )
    );
  }
}

When I include this snippet in Sky's template.php, the submitted text changes. However, when it's in Sky's subtheme, it does not change. I've done all the cache clears I should and I can confirm that a dsm($vars); before the function closes (in the Sky subtheme) does suggest that $vars['submitted'] has changed. However, the submitted text that appears is the AT default.

Please tell me I'm not going mad!!

Matthew

Comments

mshepherd’s picture

By the way, I'm successfully using a theme_preprocess_page() function, but that's not trying to override anything from further up the chain.

mshepherd’s picture

Status: Active » Closed (cannot reproduce)

Well, today, it's working like it should. I have no idea why it didn't work yesterday and why it does today...
I'll reopen this if I notice it again.

mshepherd’s picture

Status: Closed (cannot reproduce) » Active

I just flushed caches again after some node template additions to the theme and the submitted text has reverted back to the AT default.
Puzzled.

mshepherd’s picture

Status: Active » Closed (cannot reproduce)

I'm still finding this happens, but I'm finding it hard to pin down under what circumstances as sometimes it behaves as expected. I'll close until I can reliably reproduce.

mrtoner’s picture

Status: Closed (cannot reproduce) » Active

I've not been able to get theme_preprocess_node() or theme_process_node() to work; dsm($vars) doesn't fire at all. A search of the API indicates that neither of these hooks is in D7, but I still see multiple users suggesting that theme_preprocess_node() is indeed where the submitted variable should be altered.

mrtoner’s picture

Status: Active » Closed (cannot reproduce)

Okay, just ignore. I don't know why dsm($vars) doesn't work or why the API doesn't document the hook, but the function is executed when it should be.