10ответ(ов) в теме
не в сети давно
На сайте с
Участник
Тем 8
Сообщения 33
1
08:55
Версия WP-Recall: 16.8.0
Версия дополнения: 1.3.3
Ссылка на страницу: http://joball.ru/task/

Здравствуйте, в процессе добавления кода об уведомлении на сайте при помощи плагина RCL-Notification, появились некоторые сложности. А именно код добавления уведомления о новом сообщении не работает, прикладываю код.

add_action( 'rcl_chat_add_message', 'rcl_notify_task_about_chat_message', 10 );
function rcl_notify_task_about_chat_message( $messageData ) {
	global $user_ID, $wpdb;

	if ( ! isset( $_POST['fng-task'] ) || $user_ID == $messageData['user_id'] )
		return false;

	$taskId = $_POST['fng-task'];

	$task = get_post( $taskId );

	$performer = get_post_meta( $taskId, 'fng-task', 1 );

	$users = array( $performer, $task->post_author );

	$activeUsers = $wpdb->get_col( "SELECT user_id FROM " . RCL_PREF . "chat_users WHERE chat_id='" . $messageData['chat_id'] . "' AND user_activity >= ('" . current_time( 'mysql' ) . "' - interval 1 minute)" );

	foreach ( $users as $userId ) {

		if ( $userId == $user_ID || in_array( $userId, $activeUsers ) )
			continue;

		$args = array(
		'user_id'		 => $userId,
		'notice_subject' => 'Новое сообщение в рабочей области',
		'notice_content' => 'В рабочей области задания <a href="' . get_permalink( $request->task_id ) . '">' . get_permalink( $request->task_id ) . '</a>  появилось новое сообщение.'
		);
	rcl_add_notification( $args );
		
	}
	
	return false;
}

P.S.
Заметил, что на почту уведомление тоже не отправляет. Грешу на версию самого WP-recall, до последней не обновлен.

0

Fatal error: Uncaught Error: Call to undefined function ads_get_box() in /var/www/www-root/data/www/codeseller.ru/wp-content/themes/codeseller/includes/adv.php:15 Stack trace: #0 /var/www/www-root/data/www/codeseller.ru/wp-includes/class-wp-hook.php(310): add_adv_content_after_first_forum_post('pfm-single-post...', '/var/www/www-ro...') #1 /var/www/www-root/data/www/codeseller.ru/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array) #2 /var/www/www-root/data/www/codeseller.ru/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /var/www/www-root/data/www/codeseller.ru/wp-content/plugins/wp-recall/functions/files.php(57): do_action('rcl_include_tem...', 'pfm-single-post...', '/var/www/www-ro...') #4 /var/www/www-root/data/www/codeseller.ru/wp-content/plugins/wp-recall/add-on/prime-forum/functions-templates.php(117): rcl_include_template('pfm-single-post...', '/var/www/www-ro...') #5 /var/www/www-root/data/www/codeseller.ru/wp-content/plugins/wp-recall/add-on/prime-forum/themes/prime-first/templates/pfm in /var/www/www-root/data/www/codeseller.ru/wp-content/themes/codeseller/includes/adv.php on line 15