Dear visitor, welcome to Packageforge. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
|
|
XML |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?xml version="1.0" encoding="UTF-8"?> <data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com/XSD/notification-event.xsd"> <import> <event> <name>like</name> <objecttype>whatsUpEntry</objecttype> <classfile>lib/data/user/notification/event/DefaultNotificationEvent.class.php</classfile> <languagecategory>wcf.whatsUp.notification</languagecategory> <defaultnotificationtype>userMessages</defaultnotificationtype> <icon>add</icon> </event> </import> </data> |
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?php
require_once(WCF_DIR.'lib/system/event/EventListener.class.php');
require_once(WCF_DIR.'lib/data/user/notification/NotificationHandler.class.php');
/**
* @author Christopher Walz (kifferkniffer)
* @license http://forum.cwalz.de/index.php?page=TermsOfLicense
* @package de.cwalz.whatsUp
*/
class WhatsUpNotificationListener implements EventListener {
public function execute($eventObj, $className, $eventName) {
switch($className) {
case 'WhatsUpLikeAction':
NotificationHandler::fireEvent('like', 'whatsUpEntry', 1, 1); // die Zahlen sind nur zum Testen da
break;
}
}
}
?>
|
Jetzt erhalte ich auf jeder Seite des Forums folgenden Fehler:|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
Fatal error: PHP notice in file
D:\xampp\htdocs\forum\wcf\lib\data\user\notification\NotificationHandler.class.php
(422): Undefined index: object
Information:
error message: PHP notice in file
D:\xampp\htdocs\forum\wcf\lib\data\user\notification\NotificationHandler.class.php
(422): Undefined index: object
error code: 0
file: D:\xampp\htdocs\forum\wcf\lib\system\WCF.class.php (281)
php version: 5.3.5
wcf version: 1.1.8 (Tempest)
date: Fri, 02 Mar 2012 16:00:25 +0000
request: /forum/index.php?form=UserProfileEdit
referer:
Stacktrace:
#0 D:\xampp\htdocs\forum\wcf\lib\data\user\notification\NotificationHandler.class.php(422): WCF::handleError(8, 'Undefined index...', 'D:\xampp\htdocs...', 422, Array)
#1 D:\xampp\htdocs\forum\wcf\lib\data\user\NotificationUser.class.php(111): NotificationHandler::getAvailablePackageIDs()
#2 D:\xampp\htdocs\forum\wcf\lib\system\event\listener\StructuredTemplateUserMessagesNotificationListener.class.php(26): NotificationUser->hasOutstandingNotifications()
#3 D:\xampp\htdocs\forum\wcf\lib\system\event\EventHandler.class.php(207): StructuredTemplateUserMessagesNotificationListener->execute(Object(StructuredTemplate), 'StructuredTempl...', 'shouldDisplay')
#4 D:\xampp\htdocs\forum\wcf\lib\system\template\Template.class.php(255): EventHandler::fireAction(Object(StructuredTemplate), 'shouldDisplay')
#5 D:\xampp\htdocs\forum\wcf\lib\page\AbstractPage.class.php(100): Template->display('userProfileEdit')
#6 D:\xampp\htdocs\forum\wcf\lib\form\UserProfileEditForm.class.php(177): AbstractPage->show()
#7 D:\xampp\htdocs\forum\wcf\lib\page\AbstractPage.class.php(46): UserProfileEditForm->show()
#8 D:\xampp\htdocs\forum\wcf\lib\util\RequestHandler.class.php(64): AbstractPage->__construct()
#9 D:\xampp\htdocs\forum\wcf\lib\util\RequestHandler.class.php(95): RequestHandler->__construct('UserProfileEdit', Array, 'form')
#10 D:\xampp\htdocs\forum\index.php(8): RequestHandler::handle(Array)
#11 {main}
|
This post has been edited 1 times, last edit by "kifferkniffer" (Mar 2nd 2012, 5:02pm)
ein guter Anhaltspunkt ist das Plugin zur Gästebuchbenachrichtigung: WoltLab® - Plugin-Store - GästebuchbenachrichtigungenLeider verstehe ich noch nicht ganz, welche Dateien alles nötig sind, damit die Benachrichtigungen funktionieren.
Willst du die Benachrichtigungen als optionales Plugin einbinden, oder direkt in dein Paket? Wenn letzteres der Fall ist, dann brauchst du keinen EventListener, sondern kannst das Event direkt in deiner Action auslösen. Die Eventlistener verwende ich nur, da ich WoltLabs Pakete ja erweitern muss.Nun habe ich einen Eventlistener auif executed@WhatsUpLikeAction gesetzt und dort folgenden Code benutzt:

Quoted
In den Benachrichtigungseinstellungen gibt es keine Option zu meiner Benachrichtigung, wie füge ich diese hinzu?
)|
|
XML |
1 2 3 4 5 6 7 8 9 |
<category name="wcf.user.notification"> <item name="wcf.user.notification.object.type.whatsUpEntry"><![CDATA[What's Up]]></item> </category> <category name="wcf.whatsUp"> <item name="wcf.whatsUp.notification.like.title"><![CDATA[Neues "Like"]]></item> <item name="wcf.whatsUp.notification.like.description"><![CDATA[Sie erhalten eine Benachrichtigung, wenn jemand Ihren Status liked.]]></item> <item name="wcf.whatsUp.notification.like"><![CDATA[{if $event->getObject()->userID}<a href="index.php?page=User&userID={@$event->getObject()->userID}{@SID_ARG_2ND}">{$event->getObject()->username}</a>{/if} gefällt Ihr <a href="{@$event->getObject()->getURL()}{@SID_ARG_2ND}">What's Up?-Eintrag</a>.]]></item> </category> |
Der BBCode scheint sich an dem Hochkomma zu stören: What's Up. Dafür ist aber eigentlich der CDATA Block da.Edit: Hmm komisch, warum wird der XML-Syntag hier als Fehlerhaft dargestellt? Bei der Installation gibt es keine Fehler.

|
|
PHP Source code |
1 |
NotificationHandler::fireEvent('comment', 'whatsUpEntry', $this->whatsUpID, $this->ownerID, array('comment' => $this->comment, 'userID' => WCF::getUser()->userID, 'username' => WCF::getUser()->username));
|
This post has been edited 1 times, last edit by "kifferkniffer" (Mar 2nd 2012, 10:48pm)

|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// clear notification
if (WCF::getUser()->userID) {
$userIDScope = array(WCF::getUser()->userID);
$objectIDScope = array($this->whatsUpID);
$user = new NotificationUser(null, WCF::getUser(), false);
$objectTypeObject = NotificationHandler::getNotificationObjectTypeObject('whatsUpEntry');
if (isset($user->notificationFlags[$objectTypeObject->getPackageID()]) && $user->notificationFlags[$objectTypeObject->getPackageID()] > 0) {
$count = NotificationEditor::markConfirmedByObjectVisit($user->userID, array('like', 'comment'), 'whatsUpEntry', $objectIDScope);
$user->removeOutstandingNotification($objectTypeObject->getPackageID(), $count);
}
}
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
if (WCF::getUser()->userID) {
// determine users which might be affected by confirmations
$userIDScope = array($eventObj->frame->getUserID()); // dein plugin liegt im profil, also müsste es eine UserProfileFrame geben
$objectIDScope = array();
foreach ($eventObj->entryList->getObjects() as $entry) { // durchläuft alle whatsUpEntries deiner DBOList und fügt sie in den user Scope hinzu, falls sie einen Kommentar haben bzw. in den object scope, falls sie überhaupt existent sind ;) Damit enthält nun objectIDScope ALLE whatsUp Einträge, die auf der aktuellen Seite angezeigt werden. Nicht mehr und nicht weniger. Wenn deine DBOList mehr Einträge enthält ist dein Klassendesign irgendwie falsch.
if ($entry->commentTime > 0) {
$userIDScope[] = $entry->userID;
}
$objectIDScope[] = $entry->entryID;
}
if (count($objectIDScope) && in_array(WCF::getUser()->userID, $userIDScope)) { // ist der aktuelle user im Scope der Beiträge bzw. Benutzer, die auf dieser Seite eventuell eine Benachrichtigung erhalten haben?
$user = new NotificationUser(null, WCF::getUser(), false);
$objectTypeObject = NotificationHandler::getNotificationObjectTypeObject('whatsUpEntry');
if (isset($user->notificationFlags[$objectTypeObject->getPackageID()]) && $user->notificationFlags[$objectTypeObject->getPackageID()] > 0) {
$count = NotificationEditor::markConfirmedByObjectVisit($user->userID, array('like', 'comment'), 'whatsUpEntry', $objectIDScope);
$user->removeOutstandingNotification($objectTypeObject->getPackageID(), $count);
}
}
}
|
|
|
PHP Source code |
1 2 3 |
if ($entry->commentTime > 0) {
$userIDScope[] = $entry->userID;
}
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 |
// angenommen dein entry heißt $entry ;)
if ($entry->userID == WCF::getUser()->userID) { // ist der aktuelle user der "besitzer" des eintrags?
$user = new NotificationUser(null, WCF::getUser(), false);
$objectTypeObject = NotificationHandler::getNotificationObjectTypeObject('whatsUpEntry');
if (isset($user->notificationFlags[$objectTypeObject->getPackageID()]) && $user->notificationFlags[$objectTypeObject->getPackageID()] > 0) {
$count = NotificationEditor::markConfirmedByObjectVisit($user->userID, array('like', 'comment'), 'whatsUpEntry', $entry->entryID);
$user->removeOutstandingNotification($objectTypeObject->getPackageID(), $count);
}
}
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 |
if ($this->entries['userID'] == WCF::getUser()->userID) { // ist der aktuelle user der "besitzer" des eintrags?
$user = new NotificationUser(null, WCF::getUser(), false);
$objectTypeObject = NotificationHandler::getNotificationObjectTypeObject('whatsUpEntry');
if (isset($user->notificationFlags[$objectTypeObject->getPackageID()]) && $user->notificationFlags[$objectTypeObject->getPackageID()] > 0) {
$count = NotificationEditor::markConfirmedByObjectVisit($user->userID, array('like', 'comment'), 'whatsUpEntry', array($this->entries['whatsUpID']));
$user->removeOutstandingNotification($objectTypeObject->getPackageID(), $count);
}
}
|
Forum Software: Burning Board® 3.1.7, developed by WoltLab® GmbH