Hi Drupalfriends

After the user hits "Send" for a new cck node, I'd like to send the contents
of this node by email. In order to do so I installed the print module.

Then I call the appropriate function of the print module in hook_nodeapi.
This works fine as long as I am the admin user.

The anonymous user gets the access denied page. After some debugging it
turned out, that at this point the node_access table is not yet written,
which makes the access check of the print module thinking the anonymous user
does not have the right to view this node.

Any ideas to solve this problem?
Best Regards
Ernst



My code in hook_nodeapi:

      case 'insert':
        // Mail distribution
        // To: Gad Intake
        module_load_include('inc', 'print_mail', 'print_mail');
        $form = array();
        $form_state = array(
          'values' => array(
            'fld_from_name' => 'Gad Formulare',
            'fld_from_addr' => '[email protected]',
            'chk_teaser' => 0,
            'path' => 'node/'.$node->nid,
            'fld_subject' => t('New Registration'),
            'txt_to_addrs' => variable_get('zuweisung_intake_mail_adr', '
[email protected]'),
          ),
        );
        print_mail_form_submit($form, $form_state);
        // To: The institution filling in the form
        $form_state['values']['txt_to_addrs'] =
$node->field_zuw_email['0']['email'];
        print_mail_form_submit($form, $form_state);
        break;

Reply via email to