CodingJungle Posted September 25, 2020 Posted September 25, 2020 <?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} * @since {date} */ namespace IPS\{app}\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 _{class} { /** * 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( 'key' => array( 'default' => array( 'inline', 'push' ), 'disabled' => array() ), ); } // For each type of notification you need a method like this which controls what will be displayed when the user clicks on the notification icon in the header: // Note that for each type of notification you must *also* create email templates. See documentation for details: https://remoteservices.invisionpower.com/docs/devdocs-notifications /** * Parse notification: key * * @param \IPS\Notification\Inline $notification The notification * @return array * @code return array( 'title' => "Mark has replied to A Topic", // The notification title 'url' => \IPS\Http\Url::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_key( \IPS\Notification\Inline $notification ) { return array( 'title' => "Mark has replied to A Topic", // The notification title 'url' => \IPS\Http\Url::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 ); } } this is currently the boilerplate for when creating an extension, however you've added a method to this, that doesn't appear here, causing this error:
Adriano Faria Posted September 25, 2020 Posted September 25, 2020 getConfiguration will work on 4.5 (notification will be sent) but you will get an error when trying to edit notifications on ACP. It has changed in 4.5. Not documented so far.
CodingJungle Posted September 25, 2020 Author Posted September 25, 2020 2 minutes ago, Adriano Faria said: getConfiguration will work on 4.5 (notification will be sent) but you will get an error when trying to edit notifications on ACP. It has changed in 4.5. Not documented so far. sorta my point that extensions should implement an interface/extend an abstract class instead, that way if there is a change like this, it would be reflected in the interface/abstract and i wouldn't have to go on a wild goose chase to figure what this new method is expecting. since it was working for me on the notification settings on the front end, i figured it was something that was caught/fixed in 4.5.1/2/3 cause i added the method in one of my other apps, but that was back during the beta when i was upgrading it. CoffeeCake 1
Solution bfarber Posted September 28, 2020 Solution Posted September 28, 2020 Sure I'll take a look at getting it updated.
Recommended Posts