We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39452
    • 11 Posts
    код ресурса:
    [[!FormIt? &hooks=`msg-send`]]
    <form action="[[*id]]" method="post">
            <label>Кому </label><input type="text" name="to" value=""/>
              <label>Тема </label><input type="text" name="subj" value=""/>
                <label>Сообщение </label><textarea name="msg"></textarea>             
                  <input type="submit" name="send" value="send"/>
    </form>
    [[!msg-inbox? &userId=`[[+modx.user.id]]`]]
    


    код сниппета msgsenddddd:
     $userid = isset($userId) ? $userId: 0;
    if ($userid == 0) 
    {
     return 'fuck___';
    }  
    $to = $hook->getValue('to');
    print "<script>alert(".$to.");</script>";
    $message = $hook->getValue('msg');
    $subj = $hook->getValue('subj');
    $msg = $modx->newObject('modUserMessage');
    $msg->fromArray(array(
       'sender' => $userid,
         'recipient' => $to,
         'message' => $message,
         'subject' => $subj,
         'read' => 0,
         'private' => 1,
         'date_sent'=> strftime('%Y-%m-%d %T')
    ));
    $msg->save();
    return true;/**/ 


    Где ошибка? может в настройках системы что-то не так?
      • 39452
      • 11 Posts
      название снипета в посте выше - 'msg-send', отредактировать не могу( [ed. note: al3x777 last edited this post 14 years, 6 months ago.]
        • 39452
        • 11 Posts
        разобрался где ошибка, возник вопрос как в сниппете определить ид текущего юзера?
          • 31246 ☆ A M B ☆
          • 428 Posts
          $modx->user->get('id');
            Valentin Rasulov - Industrial design (Hobbies - Web Development)
            Development not standard projects on CMF MODx Revolution.
            Small sample of extensions
            • 39452
            • 11 Posts
            спасибо