Exemple #1
0
     $forum->addPost();
     if ($create) {
         $forum->addTopic();
     }
     $forum->save();
     // Incrementamos el nivel de posts del usuario
     if ($xoopsUser) {
         $member_handler =& xoops_gethandler('member');
         $member_handler->updateUserByField($xoopsUser, 'posts', $xoopsUser->getVar('posts') + 1);
     }
     // Notificaciones
     include_once XOOPS_ROOT_PATH . '/kernel/notification.php';
     $not = new XoopsNotificationHandler($xoopsDB);
     if ($create) {
         //Notificacion de nuevo tema en foro
         $not->triggerEvent('forum', $forum->id(), 'newtopic', array('topic' => $topic->id()));
         //Notificación de nuevo mensaje en cualquier foro
         $not->triggerEvent('any_forum', '', 'postanyforum', array('forum' => $forum->id(), 'post' => $post->id()));
     } else {
         //Notificación de nuevo mensaje en tema
         $not->triggerEvent('topic', $topic->id(), 'newpost', array('post' => $post->id()));
         //Notificación de nuevo mensaje en foro especificado
         $not->triggerEvent('forum', $forum->id(), 'postforum', array('post' => $post->id()));
         //Notificación de nuevo mensaje en cualquier foro
         $not->triggerEvent('any_forum', '', 'postanyforum', array('forum' => $forum->id(), 'post' => $post->id()));
     }
     redirect_header('topic.php?pid=' . $post->id() . '#p' . $post->id(), 1, $errors == '' ? __('Your posts has been sent!', 'bxpress') : __('Message posted, however some errors ocurred while sending!', 'bxpress') . '<br />' . $errors);
     break;
 default:
     $xoopsOption['template_main'] = "bxpress_postform.html";
     $xoopsOption['module_subpage'] = "post";