[PHP] core.modify_user_rank (change)

Request hook events and what data needs to be sent for the new hook system.
Post Reply
User avatar
Wolfsblvt
Registered User
Posts: 5
Joined: Tue Oct 28, 2014 8:35 am

[PHP] core.modify_user_rank (change)

Post by Wolfsblvt »

Identifier: core.modify_user_rank
Location: includes/functions_display.php:1454

Code: Select all

    $user_rank_data = array(
        'title'        => null,
        'img'        => null,
        'img_src'    => null,
    );

    /**
    * Preparing a user's rank before displaying
    *
    * @event core.modify_user_rank
    * @var    array    user_data        Array with user's data
    * @var    int        user_posts        User_posts to change
    * @since 3.1.0-RC4
    */

    $vars = array('user_data', 'user_posts');
    extract($phpbb_dispatcher->trigger_event('core.modify_user_rank', compact($vars))); 
Parameters: + $user_rank_data
Explanation:
Okay, I get, I can change the user rank to another, I can increase his post number.
But why can't i directly set the user rank? I thought that this would be possible, event name sounds like that.

I would suggest to add the rank_data and if filled, don't do the code below, just return the data array.
Lesser, greater, middling, it's all the same. Proportions are negotiated, boundaries blurred.
I'm not a pious hermit, I haven't done only good in my life. But if I'm to choose between one evil and another,
then I prefer not to choose at all.

― Andrzej Sapkowski, The Last Wish

User avatar
skovacs1
Registered User
Posts: 2
Joined: Wed Dec 02, 2015 2:25 am

Re: [PHP] core.modify_user_rank (change)

Post by skovacs1 »

Not sure why this hasn't been moved to a current branch of RFCs (or if it will be - it's like a year old), but it's still a valid event request with no signs of review so I'm bumping it with more details to see if it can get moved/reviewed since I find myself wanting for this change to be effected and apparently cannot create a fresh topic in the corresponding forum myself.

The most straightforward use-case for this event is adding or changing the conditions on which a rank is based. In my case, I have a board administrator who would like an extension to make it so that ranks can be based on how old the user account is in addition to number of posts, but, in theory, this could be applicable to any number of other conditions/extensions. Other readily available examples are basing rank on an achievement system by number of achievements or a voting/rating system by the votes/rating received or given.

As it presently stands, the core.modify_user_rank event only provides a mechanism by which to fudge the post count or assign special ranks, but does not allow for integration with or replacement of the existing post count system without making every rank special and re-implementing the post count check for our special assignment if desired. If every rank has to be made special, then what's so special about them? Moreover, making every rank special just so that they can be based on different criteria is unintuitive to administrators changing and adding ranks.

Whether this is implemented by moving the existing event further down the code or adding another event within or after the rank calculation, giving more control over the rank output is essentially the idea behind this RFC.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1903
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [PHP] core.modify_user_rank (change)

Post by DavidIQ »

This stands as not done because it is normally expected that the proposer create a ticket and maybe sends a pr for it. The ticket part was never done and thus nothing ever came from this. Devs work off of the tracker, not the forum.
Image

User avatar
skovacs1
Registered User
Posts: 2
Joined: Wed Dec 02, 2015 2:25 am

Re: [PHP] core.modify_user_rank (change)

Post by skovacs1 »

DavidIQ wrote: Wed Dec 02, 2015 4:19 am This stands as not done because it is normally expected that the proposer create a ticket and maybe sends a pr for it. The ticket part was never done and thus nothing ever came from this. Devs work off of the tracker, not the forum.
Understood. So you're suggesting I create the ticket and PR then. Fair enough. I'll see what I can do. Thanks for the quick response, David.

I've created the JIRA Ticket https://tracker.phpbb.com/browse/PHPBB3-14331

I'd like to see more discussion before I jump on a pull request unless you think the only way this will get traction is if I just implement a solution myself and put it up there.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1903
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [PHP] core.modify_user_rank (change)

Post by DavidIQ »

I think that if you send a pr with what you perceive is the solution that it will probably gain more traction and the devs can comment on and work with you within the pr to adjust things if necessary.
Image

Post Reply