*/ class WiseChatNotificationsTab extends WiseChatAbstractTab { public function getFields() { return array( array('_section', 'User Notifications', 'User notifications are sent when a private message is posted. Note that only registered WordPress users can receive such notifications. If the user is currently online then no notification is sent.', array('hideSubmitButton' => true)), array('user_notifications', 'E-mail Notifications', 'userNotificationsListCallback', 'void'), array('user_notification_add', 'New E-mail Notification', 'userNotificationAddCallback', 'void'), array('_section', 'Admin Notifications', 'Admin notifications are sent when a message is posted in the chat\'s public channel.', array('hideSubmitButton' => true)), array('notifications', 'E-mail Notifications', 'notificationsListCallback', 'void'), array('notification_add', 'New E-mail Notification', 'notificationAddCallback', 'void'), ); } public function getDefaultValues() { return array( 'notifications' => null, 'notification_add' => null, 'user_notifications' => null, 'user_notification_add' => null, ); } public function notificationsListCallback() { $html = ""; $html .= ''; $html .= '
No notifications created yet
'; print($html); } public function notificationAddCallback() { $currentUser = wp_get_current_user(); // actions: $actionsHtmlOptions = ''; // frequencies: $frequenciesHtmlOptions = ''; $recipient = ($currentUser instanceof WP_User ? $currentUser->user_email : ''); $subject = 'New Message in Chat'; $content = sprintf("Hello%s,\n\nA new message has been posted in the chat.\n\nUser: \${user}\nChannel: \${channel}\nMessage: \${message}\n\nBest regards,\n%s", $currentUser instanceof WP_User ? ' '.$currentUser->display_name : '', get_bloginfo( 'name' )); $buttonLabel = 'Add Notification'; echo sprintf( ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. '
Send when:

No more than:
E-mail:
Subject:
Content:

Available variables: ${user}, ${message}, ${channel}

%s
', $actionsHtmlOptions, $frequenciesHtmlOptions, $recipient, $subject, $content, $buttonLabel ); $this->printProFeatureNotice(); } public function userNotificationAddCallback() { $frequenciesHtmlOptions = ''; $subject = 'New Private Message from ${sender}'; $content = "Hello \${recipient},\n\nA new message has been sent to you in the chat.\n\nSender: \${sender}\nGo to the chat page: \${link}\n\nBest regards,\n".get_bloginfo( 'name' ); $buttonLabel = 'Add Notification'; echo sprintf( ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. '
No more than: from each user separately
Subject:
Content:

Available variables: ${recipient}, ${recipient-email}, ${sender}, ${link}, ${message}, ${channel}

%s
', $frequenciesHtmlOptions, $subject, $content, $buttonLabel ); $this->printProFeatureNotice(); } public function userNotificationsListCallback() { $html = ""; $html .= ''; $html .= '
No user notifications created yet
'; print($html); } }