[RFC] Warn user events

These requests for events in core phpBB have been merged into 3.1/Ascraeus and will be available with the next release.
Post Reply
aleha
Registered User
Posts: 143
Joined: Tue Mar 26, 2013 2:19 am

[RFC] Warn user events

Post by aleha »

I would like propose two core events for after warning a user. The reason for those events is for use with an automated ban system based on user warning count such as this mod.

Currently you can warn a user either for a post or give a warning straight from MCP, hence the two events.
  • Identifier: core.mcp_warn_post_after
    Location: phpBB/includes/mcp/mcp_warn.php, after L277
    Parameters: user_id, username, user_warnings, post_id, forum_id notify
    Explantion:
  • Identifier: core.mcp_warn_user_after
    Location: phpBB/includes/mcp/mcp_warn.php, after L389
    Parameters: user_id, username, user_warnings, notify
    Explantion:
Please note that in both cases the whole user row is available and in the first case the whole post row is available, that is in case more parameters should be included. I haven't included the warning message in the parameters because I can't find much of a use for it after a warning.

Notes: The parameter user_warnings is not consistent with an event named *_after because it is updated by the function than inserts the warning in the db . I included it just to avoid an extra query in users table, but maybe it should be omitted?

The above events could have their companions named *_before. The main reason for the *_before events would be to change the message that you send when you warn a user. In that case the parameter user_warnings will be consistent. Those events could be used by a mod that creates pre defined warning reasons like this one for example .
  • Identifier: core.mcp_warn_post_before
    Location: phpBB/includes/mcp/mcp_warn.php, before [url=hhttps://github.com/phpbb/phpbb/blob/develop-ascraeus/phpBB/includes/mcp/mcp_warn.php#L276]L276[/url]
    Parameters: user_id, username, user_warnings, warning, post_id, forum_id, notify
    Explantion:
  • Identifier: core.mcp_warn_user_before
    Location: phpBB/includes/mcp/mcp_warn.php, before L388
    Parameters: user_id, username, user_warnings, warning, notify
    Explantion:
At the moment I am mostly up for the *_after events. Please let me know what you think so that I can make tickets and a PR.

aleha
Registered User
Posts: 143
Joined: Tue Mar 26, 2013 2:19 am

Re: [RFC] Warn user events

Post by aleha »


aleha
Registered User
Posts: 143
Joined: Tue Mar 26, 2013 2:19 am

Re: [RFC] Warn user events

Post by aleha »

These two events have been merged.
All the functionality one needs is passed to the event vars array.

Post Reply