Would it be to possible to change a theme also when replying/editing or deleting a forum's comments ? As at the moment if there is a different theme for a forum and one wants to reply/edit or delete a comment it jumps to default scheme.

Comments

profix898’s picture

Inspired by your request I coded an extended version that should
meet your requirements. Please try the code from cvs head AND
let me know if its working as expected!

kahy’s picture

thank you very much for that patch, but unfortunately it doesn't work for me.it always takes me to the default theme whenever I try to delete,edit or reply a comment. I tried to 'investigate' a bit ;-) and i think it can work,at the moment, only for replying (348: preg_match('#comment/reply/([0-9]*).*#', $uri, $matches), but still, it doesn't :-(

So I put there some debugging messages in the code

$term = db_fetch_object(db_query('SELECT tid FROM {forum} WHERE nid = %d', $matches[1]));
error_log($term->tid);
$custom_theme = variable_get('taxonomy_theme_forum|' . $term->tid, variable_get('theme_default', 'bluemarine'));
error_log($custom_theme);

and the result is that

$term->tid - is always 0

and in $custom_theme is my default theme.

couldn't it be problem in my categories settings ? As the attribute tid is everywhere 0 in the table 'forum' .

profix898’s picture

What I added is
- all reply/comment pages
- all nodes belonging to the forum (incl. add/view/edit)
should be themed with the forum's theme.

... and i think it can work,at the moment, only for replying ...

Yes. The code you mentioned is responsible for replies. But why ONLY?
What else do you need? Apply forum's theme to add comment is
done in the ereg('^node/add/forum/', $uri) block and view/edit
forum node is done within the switch blocks.

$term->tid - is always 0

Aha. On my system the 'forum' table contains all forum topic/comment
nodes (nid) and connects them to the forum they belong to (tid).

I did a quick look through the forum.module code and they use
$results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $object->tid);
the same relation in their hook_taxonomy. So I'm wondering why it doesnt
work for you.

As the attribute tid is everywhere 0 in the table 'forum'.

I suppose your looked a the table directly, yes? And tid is really 0 for every item?
You guess I'm a little confused since it works for me. I found some issues in my
modified code though, but it doesnt explain why your tid is 0 ...

Maybe I will write the forum developers or post to Drupal.org forums on that.

Thilo

profix898’s picture

It seems like more people are having trouble with that.
So it look more a forum.module related problem.
Look at http://drupal.org/node/54493

kahy’s picture

I changed some forum's taxonomy settings by the post's advice (to by honest i din't really get how these things about taxonomy and vocabulary work ;-) and when i created a new forum, there appeared a non-zero tid in the forum table and switching theme started working. But it only works for replying and adding a new comment. when i want to delete or edit a comment it gets me back to default theme.
May I also ask you whether would it be somehow possible to specify a theme after logging user out according to node where he logged out. Actually, the whole idea is to have something like an 'independent' sub-site under main drupal with its own theme. Thank you.

profix898’s picture

when i want to delete or edit a comment it gets me back to default theme

Try the new version from cvs head. It should work correctly with edit/delete comments now.

specify a theme after logging user out according to node where he logged out

I'm not sure, I understand what you are trying to do ...
The theme does not depend on whether the user is logged in or not. What means
when he/she logs out, he/she should see the same theme applied to a particular
node as before. Do you want to have different themes for logged in users?
Maybe you can explain this a little bit more ...

kahy’s picture

Try the new version from cvs head. It should work correctly with edit/delete comments now.

Excellent ! It works perfectly now. Thank you.

specify a theme after logging user out according to node where he logged out

What I would like to have is something like a theme specific subsite or section which would behave like an 'almost independent ' site. So Drupal would act as a container of several sections (subsite) with their own themes. So for instance I would have Drupal installed and hosted on www.generalshop.com with some default theme and when an user went to the section www.generalshop.com/books , the theme would change and stay the same regardless user is logged in or logged out.
Does it make little bit sense now ?

profix898’s picture

Have you tried taxonomy_theme with selection method set to
vocab-based? From what I understand it does what you want!?
You can set a different theme for every vocab/section and it
IS independent of the user's status.

profix898’s picture

Status: Active » Closed (fixed)

This has been added to release. Closing feature request.