Hi,

(Don't kill me, I'm new to this)

I'm trying to create a module which will only show a specific function when i create/edit forum topics or comments.
When i add a forum node this is what i can use:

Forum topic:

add: node/add/forum arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'forum'

But when i want to edit this node i have this:

edit: node/nid/edit arg(0) == 'node' && arg(2) == 'edit'

This is not enough and will be true for any node. If i could use $node->type == 'forum' for forum nodes and comments then this would be good. But i tried it but its empty.

How can i find out if its forum related in my custom function?

Thx,

Carlo

Comments

AjK’s picture

I think this is what you're looking for hook_nodeapi()

clandmeter’s picture

My head starts to hurt. It seems i don't know enough about functions and objects to get this working.

What I am actually trying to do is making the quicktags module only to show on add/edit forum nodes/comments.
The nodeapi function is not in this module, the owner created a function which checks the arg settings.

function quicktags_show_quicktags() {
  if (user_access('use quicktags')) {
    switch (variable_get('quicktags_show', 0)) {
      case 0:
        return TRUE;
        break;
      case 1:
        if (arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')) {
          return TRUE;
        }
        break;
      case 2:
        if (arg(0) == 'node' || arg(0) == 'comment') {
          return TRUE;
        }
        break;
      default:
        return FALSE;
    }
  }
  else {
    return FALSE;
  }
}

How would i be able to change it so it also checks if its a forum node/comment?

Thx,

Carlo