Extension talk:EditNotify

From mediawiki.org
Jump to navigation Jump to search

Related documentation[edit]

Thanks for the documentation! When you consider the extension ready to be used by others, please add links from related documentation, like the MediaWiki core feature Manual:$wgUsersNotifiedOnAllChanges. Nemo 08:39, 1 September 2016 (UTC)

Exclude some namespaces[edit]

This extension could be very useful if one can exclude notifications from some namespaces (action => create), i.e. "File" namespace, because it produces enormous amount of notifications. 15:04, 20 December 2016 (UTC)

filed as bug https://phabricator.wikimedia.org/T240656 --Wikinaut (talk) 08:09, 13 December 2019 (UTC)
and another one, allow only one unread notification for one page, i.e. if some one made multiple edits of one page in an hour 10:50, 21 December 2016 (UTC)

Warnings and notices[edit]


  • MediaWiki 1.27.1 (36b636d) 20:26, 11. Jan. 2017
  • PHP 5.6.29-0+deb8u1 (apache2handler)
  • MariaDB 10.0.29-MariaDB-0+deb8u1
  • Page Forms 4.1 (f97847f) 18:30, 15. Nov. 2016
  • Edit Notify 1.0.0
  • Edit Notify Connector 0.1.0


Warning: Invalid argument supplied for foreach() in /.../w/extensions/EditNotify/EditNotify.hooks.php on line 807
Warning: Invalid argument supplied for foreach() in /.../w/extensions/EditNotify/EditNotify.hooks.php on line 807
Notice: Undefined variable: categoryUserArray in /.../w/extensions/EditNotify/EditNotify.hooks.php on line 850
Warning: array_diff(): Argument #1 is not an array in /.../w/extensions/EditNotify/EditNotify.hooks.php on line 850
Warning: array_unique() expects parameter 1 to be array, null given in /.../w/extensions/EditNotify/EditNotify.hooks.php on line 850
Warning: array_merge(): Argument #2 is not an array in /.../w/extensions/EditNotify/EditNotify.hooks.php on line 853
Warning: Invalid argument supplied for foreach() in /.../w/extensions/EditNotify/EditNotify.hooks.php on line 855

This armada of notices and warnings is emitted multiple times when editing a page using the Page Forms extension.

Cheers --[[kgh]] (talk) 23:12, 14 February 2017 (UTC)

@Yaron Koren: FYI.

It sounds like the problem might be just that you haven't set $wgEditNotifyAlerts. (Although the code should itself set a default value of a blank array for that variable, to prevent these error messages - that's a bug.) What's "Edit Notify Connector", by the way - an extension of yours? Yaron Koren (talk) 15:19, 15 February 2017 (UTC)
Oops, I indeed set nothing to $wgEditNotifyAlerts. EditNotify was added to the BlueSpice software bundle which also includes the Edit Notify Connector extension integrating this extension into the bundle. I just deployed Edit Notify without further thought. It is automatically invoked via one of the config files they provide so I relied on this. Having a default value preventing the error messages from happening will indeed be cool. Cheers --[[kgh]] (talk) 21:03, 15 February 2017 (UTC)
Oh, good to know. Yaron Koren (talk) 01:12, 16 February 2017 (UTC)

Track certain namespaces pages creation[edit]

filed as bug https://phabricator.wikimedia.org/T240656 --Wikinaut (talk) 08:09, 13 December 2019 (UTC)
EditNotify.hooks.php: ↓
	public static function onPageContentInsertComplete( WikiPage $wikiPage, User $user, $content, $summary,
		$isMinor,$isWatch, $section, $flags, Revision $revision ) {

		//notify locally by echo event
		$title = $wikiPage->getTitle();
		$NSnum = $title->getNamespace();

		$condstr = 'up_property = "editnotify-prefs-local-create-ns' . $NSnum . '"';

		$dbr = wfGetDB( DB_SLAVE );
		$rows = $dbr->select(
			array( 'up_user' ),

		foreach( $rows as $row) {
			self::pageCreateNotify( $title, 'edit-notify-page-create', $row->up_user );

		//notify by email

		global $wgSitename, $wgPasswordSender;
		$username = $user->getName();
		$from = new MailAddress( $wgPasswordSender,
			wfMessage( 'emailsender' )->inContentLanguage()->text() );
		$prefixText = $title->getPrefixedText();
		$subject = wfMessage( 'emailallchanges-subject' )->params( $wgSitename, $prefixText )->plain();

		$body = wfMessage( 'emailallchanges-body1' )->params(
		$body .=" \n" . $title->getFullURL() . "\n\n";
		$body .= wfMessage( 'emailallchanges-body2' )->params(
			ContentHandler::getContentText( $content )

		$replyto = null;

		$condstr = 'up_property = "editnotify-prefs-email-create-ns' . $NSnum . '"';

		$rows = $dbr->select(
			array( 'up_user' ),

		foreach( $rows as $row) {
			$OUser = User::newFromId( $row->up_user );
			$to = MailAddress::newFromUser( $OUser );

			UserMailer::send( $to, $from, $subject, $body, $replyto );

	 * @param $pageTitle
	 * @param $pageType
	 * @param $user
	 * @return bool
	public static function pageCreateNotify( $pageTitle, $pageType, $user ) {
		EchoEvent::create( array(
			'type' => $pageType,
			'extra' => array(
				'title' => $pageTitle,
				'user-id' => $user,
			'title' => $pageTitle
		) );
		return true;

	 * @param $user
	 * @param $preferences
	 * @return bool
	public static function onGetPreferences( $user, &$preferences ) {

		global $wgExtraNamespaces;

		$NSList = $wgExtraNamespaces;
		$NSList[0] = '(main)';
		$NSList[10] = 'Template';
		$NSList[12] = 'Help';

		foreach( array_keys($NSList) as $currNS) {
			if (($currNS % 2) == 0) {
				$currNSName = $NSList[$currNS];
				$rows[$currNSName] = 'ns' . $currNS;

		$columns = array(
			'Email' => 'email-create',
			'Local' => 'local-create',

		$preferences['editnotify-prefs'] = array(
			'class' => 'HTMLCheckMatrix',
			'section' => 'newnotifications/page-create-notifs',
			'rows' => $rows,
			'columns' => $columns,
			'prefix' => 'editnotify-prefs-',

		return true;

you will get ability to track certain namespaces pages creation and every user can toggle this in settings manually. But you need to add hook and some strings to language files

	"Hooks": {
		"BeforeCreateEchoEvent": [
		"EchoGetDefaultNotifiedUsers": [
		"PageContentSave": [
		"PageContentInsertComplete": [
		"GetPreferences": [
"prefs-newnotifications": "New Notifications",
  "prefs-page-create-notifs": "Page creation",
  "prefs-page-edit-notifs": "Page edit" 15:15, 10 April 2017 (UTC)

Namespaces ang page creation notification[edit]

Hi and thank you for this very useful extension.

in 6 Issues of the extension you say that "when you are subscribing for create page notifications, don t include namespace"

but in 4 Usage you put an example with a namespace for page creation notification. :(

Can I remove the line 'namespace' => 'namespace name',


Nicolas NALLET Wiki-Valley.com, Semantiki.fr (talk) 09:41, 23 March 2017 (UTC)

User-subscribed notifications[edit]

So this extension requires an admin with access to LocalSettings.php to manage the list of users to whom the notifications are sent both via web (Echo) and via email. How do I add the notification types enabled by this extension to User preferences for Notifications (Echo) so that they manage their own notifications?

Ultimately, I want to allow users to opt-in to notifications for changes to pages on their watchlist. MW already allows email notifications, but I like to provide an option to receive only Web notifications. I figured this extension is the closest thing I've found so far that might allow this.

--Tommy H (talk) 02:07, 29 June 2019 (UTC)

@Tommy H, any plans on implementing this feature yourself soon? We also have a need for it on my wiki. If not, I might do it in the coming months. Tinss (talk) 22:20, 19 September 2019 (UTC)
@Tinss, not really, my skillset in this area is very limited and haven't had the opportunity to get over the learning curve. Tommy H (talk) 00:18, 25 September 2019 (UTC)
@Tommy H, no worries, I'll try to inform you if I ever get to making an extension for this. I might then need your help for some testing :) Tinss (talk) 22:32, 26 September 2019 (UTC)

Support for group[edit]

Is it possible to set these settings for members of an entire group? Even if there were some other code we could use to yank all the members of a group into an array and then use that when calling the "users" argument. --Realsalt (talk) 17:56, 16 April 2021 (UTC)