Posted 9 августа, 20213 yr comment_171121 Я пытаюсь использовать плагин "Raffles". Он работает нормально, но я получаю эту ошибку, когда пытаюсь изменить настройки уведомлений в панели администратора: Spoiler Error: Call to undefined method IPS\raffles\extensions\core\Notifications\Tickets::configurationOptions() (0) #0 mydomain.com/public_html/home/system/Dispatcher/Controller.php(90): IPS\core\modules\admin\membersettings\_notifications->edit() #1 mydomain.com/public_html/home/applications/core/modules/admin/membersettings/notifications.php(38): IPS\Dispatcher\_Controller->execute() #2 mydomain.com/public_html/home/system/Dispatcher/Dispatcher.php(153): IPS\core\modules\admin\membersettings\_notifications->execute() #3 mydomain.com/public_html/home/admin/index.php(13): IPS\_Dispatcher->run() #4 {main} Плагин использует устаревшую систему уведомлений. Мне нужно обновить его, и я попробовал. Но я не совсем опытен. Это проблемный файл: Spoiler <?php /** * @brief Notification Options * @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a> * @copyright (c) 2001 - 2016 Invision Power Services, Inc. * @license http://www.invisionpower.com/legal/standards/ * @package IPS Community Suite * @subpackage Raffles * @since 12 May 2017 * @version SVN_VERSION_NUMBER */ namespace IPS\raffles\extensions\core\Notifications; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * Notification Options */ class _Tickets { /** * Get configuration * * @param \IPS\Member $member The member * @return array */ public function getConfiguration( $member ) { // Basically just return a list of the keys for the types of notification your app will send // keys can be anything you want. You can specify what should be the default value and any disabled values (acceptable values are "email" and "inline") // For each key, create a language string "notifications__<key>" which is what will display in the user's Notification Options screen $return = array( 'raffle_payment_done' => array( 'default' => array( 'inline' ), 'disabled' => array() ), 'raffle_winner' => array( 'default' => array( 'inline' ), 'disabled' => array() ), ); if ( \IPS\Member::loggedIn()->inGroup( explode( ',', \IPS\Settings::i()->raffles_auto_pick_winners_groups ) ) AND !\IPS\Settings::i()->raffles_auto_pick_winners ) { $return['raffle_expired'] = array( 'default' => array( 'email' ), 'disabled' => array(), 'icon' => 'lock' ); } return $return; } public function parse_raffle_payment_done( \IPS\Notification\Inline $notification ) { $item = $notification->item; if ( !$item ) { throw new \OutOfRangeException; } if ( $notification->extra ) { $memberId = $notification->extra; if( \is_array( $memberId ) ) { $memberId = array_pop( $memberId ); } $author = \IPS\Member::load( $memberId ); } else { $author = new \IPS\Member; } $member = \IPS\Member::load( $item->member_id ); return array( 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'notification__raffle_payment_done', FALSE, array( 'sprintf' => array( $item->title ) ) ), 'url' => $notification->item->url(), 'author' => $author, ); } public function parse_raffle_expired( \IPS\Notification\Inline $notification ) { $item = $notification->item; if ( !$item ) { throw new \OutOfRangeException; } if ( $notification->extra ) { $memberId = $notification->extra; if( \is_array( $memberId ) ) { $memberId = array_pop( $memberId ); } $author = \IPS\Member::load( $memberId ); } else { $author = new \IPS\Member; } $member = \IPS\Member::load( $item->member_id ); return array( 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'notification__raffle_expired', FALSE, array( 'sprintf' => array( $item->title ) ) ), 'url' => $notification->item->url(), 'author' => $author, ); } public function parse_raffle_winner( \IPS\Notification\Inline $notification ) { $item = $notification->item; if ( !$item ) { throw new \OutOfRangeException; } if ( $notification->extra ) { $memberId = $notification->extra; if( \is_array( $memberId ) ) { $memberId = array_pop( $memberId ); } $author = \IPS\Member::load( $memberId ); } else { $author = new \IPS\Member; } $member = \IPS\Member::load( $item->member_id ); return array( 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'notification__raffle_winner', FALSE, array( 'sprintf' => array( $item->title ) ) ), 'url' => $notification->item->url(), 'author' => $author, ); } } Вот рабочий файл (уведомление "Загрузки"): Spoiler <?php /** * @brief Notification Options * @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a> * @copyright (c) Invision Power Services, Inc. * @license https://www.invisioncommunity.com/legal/standards/ * @package Invision Community * @subpackage Downloads * @since 11 Dec 2014 */ namespace IPS\downloads\extensions\core\Notifications; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * Notification Options */ class _Files { /** * Get fields for configuration * * @param \IPS\Member|null $member The member (to take out any notification types a given member will never see) or NULL if this is for the ACP * @return array */ public static function configurationOptions( \IPS\Member $member = NULL ) { return array( 'new_file_version' => array( 'type' => 'standard', 'notificationTypes' => array( 'new_file_version' ), 'title' => 'notifications__downloads_Files', 'showTitle' => FALSE, 'description' => 'notifications__downloads_Files_desc', 'default' => array( 'inline', 'push', 'email' ), 'disabled' => array() ) ); } /** * Parse notification: new_file_version * * @param \IPS\Notification\Inline $notification The notification * @param bool $htmlEscape TRUE to escape HTML in title * @return array * @code return array( 'title' => "Mark has replied to A Topic", // The notification title 'url' => \IPS\Http\Url\Friendly::internal( ... ), // The URL the notification should link to 'content' => "Lorem ipsum dolar sit", // [Optional] Any appropriate content. Do not format this like an email where the text // explains what the notification is about - just include any appropriate content. // For example, if the notification is about a post, set this as the body of the post. 'author' => \IPS\Member::load( 1 ), // [Optional] The user whose photo should be displayed for this notification ); * @endcode */ public function parse_new_file_version( $notification, $htmlEscape=TRUE ) { $item = $notification->item; if ( !$item ) { throw new \OutOfRangeException; } return array( 'title' => ( $item->container()->version_numbers ) ? \IPS\Member::loggedIn()->language()->addToStack( 'notification__new_file_version_with', FALSE, array( 'sprintf' => array( $item->author()->name, $item->version, $item->mapped('title') ) ) ) : \IPS\Member::loggedIn()->language()->addToStack( 'notification__new_file_version', FALSE, array( 'sprintf' => array( $item->author()->name, $item->mapped('title') ) ) ), 'url' => $notification->item->url(), 'content' => $notification->item->content(), 'author' => $notification->extra ?: $notification->item->author(), 'unread' => (bool) ( $item->unread() ) ); } /** * Parse notification for mobile: new_file_version * * @param \IPS\Lang $language The language that the notification should be in * @param \IPS\downloads\File $file The file * @return array */ public static function parse_mobile_new_file_version( \IPS\Lang $language, \IPS\downloads\File $file ) { return array( 'title' => $language->addToStack( 'notification__new_file_version_title' ), 'body' => $language->addToStack( 'notification__new_file_version', FALSE, array( 'htmlsprintf' => array( $file->author()->name, $file->mapped('title') ) ) ), 'data' => array( 'url' => (string) $file->url(), 'author' => $file->author() ), 'channelId' => 'files', ); } } Я попытался сымитировать рабочий файл, но не было трех типов уведомлений, отображался только общий. Во всяком случае, я не мог заставить его работать. Любая помощь будет оценена по достоинству! Файл: (SOS44) Raffles System 1.3.0 Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/ Share on other sites Больше вариантов
9 августа, 20213 yr comment_171134 Пробуйте обновить приложение 1.4.2 1.3.1 Fix: Issues related to Members Shop integration Enhancements: Adjustment for Lazy Load Adjustment for Post Before Registering 1.3.2 Template issue for those who hasn't Commerce installed ReflectionException on Rest API 1.3.3 New Feature: From now on you can convert a review to a comment. A new moderator permission will control who can use the feature. Enhancements: Added ability to choose extra field position per field (sidebar or below raffle/giveaway description) Script optimization due to new marketplace guidelines drop columns from members table and use own table to store members preferences Random sorting in Raffle feed widget Rework in raffle post screen to make fields (type of payment, money and points) appears only when necessary Rework in some templates 1.3.4 Fix: Can't see all prizes in mobile devices Participants messed up in mobile devices Fix: Fix issue in generated topic (post where winners are displayed) Delete unused templates 1.3.5 Fix hardcoded strings in raffle countdown 1.3.7 Removes number of tickets from giveaways view Additional checking for raffles with "0.00" cost 1.4.0 New Feature: Add a price filter on category view to filter raffles by price.A new option will show on Admin CP to add your price range. This option will show up only if you have Commerce app installed. 1.4.1 Fix error when trying to delete comments. 1.4.2 Fix integratation with Members Shop Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171134 Share on other sites Больше вариантов
9 августа, 20213 yr Author comment_171135 13 minutes ago, 001 said: Пробуйте обновить приложение 1.4.2 Я уже использую эту версию. 😕 Разработчик исправил это только в 1.5.2 или около того. Edited 9 августа, 20213 yr by BlackShot Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171135 Share on other sites Больше вариантов
9 августа, 20213 yr comment_171137 8 минут назад, BlackShot сказал: Я уже использую эту версию. А нам где ее взять для проверки? Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171137 Share on other sites Больше вариантов
9 августа, 20213 yr Author comment_171139 15 minutes ago, Desti said: Where can we get it for verification? Если мы сможем это исправить, я опубликую обновленную / исправленную версию на форумах! 😁 raffles 1.4.2.tar Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171139 Share on other sites Больше вариантов
9 августа, 20213 yr comment_171144 Fast & dirty /** * Get configuration * * @param \IPS\Member $member The member * @return array */ public static function configurationOptions( \IPS\Member $member = NULL ) { $return = array( 'raffle_payment_done' => array( 'type' => 'standard', 'title' => 'Payments done', 'description' => 'Add description 1', 'default' => array( 'inline' ), 'disabled' => array() ), 'raffle_winner' => array( 'type' => 'standard', 'title' => 'Notify "You Winner!"', 'description' => 'Add description 2', 'default' => array( 'inline' ), 'disabled' => array() ) ); if ( \IPS\Member::loggedIn()->inGroup( explode( ',', \IPS\Settings::i()->raffles_auto_pick_winners_groups ) ) AND !\IPS\Settings::i()->raffles_auto_pick_winners ) { $return['raffle_expired'] = array( 'type' => 'standard', 'title' => 'Expired', 'description' => 'Add description 3', 'default' => array( 'inline' ), 'disabled' => array() ); } return $return; } Добавить это в файл exten../../tickets.php Дальше протестировать не могу, поскольку не понимаю, что это и как работает. Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171144 Share on other sites Больше вариантов
9 августа, 20213 yr comment_171151 Для красоты надо для 'title' и 'desctiption' добавить поля в lang файл'. Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171151 Share on other sites Больше вариантов
14 августа, 20213 yr Author comment_171482 Desti Спасибо, я не был уведомлен о ваших ответах!! Я попробую и дам вам знать! Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171482 Share on other sites Больше вариантов
14 августа, 20213 yr Author comment_171483 EDIT: Идеальный! Оно работает!! Спасибо, @Desti!!! Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=171483 Share on other sites Больше вариантов
3 декабря, 20212 yr comment_175346 BlackShot не могли бы поделиться исправленной версией? Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=175346 Share on other sites Больше вариантов
6 декабря, 20212 yr Author comment_175465 On 12/3/2021 at 5:01 AM, Dobrochas said: BlackShot could you share the revised version? Here it is. raffles 1.4.2.tar Link to comment https://ipbmafia.ru/topic/23390-kto-nibud-mozhet-pomoch-mne-obnovit-etot-fajl/?&do=findComment&comment=175465 Share on other sites Больше вариантов
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.