HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Need help with the event UserCell

For the dashboard users view, there are two files that contain a FireEvent['UserCell']:
https://github.com/vanilla/vanilla/blob/2.1/applications/dashboard/views/user/index.php#L51
https://github.com/vanilla/vanilla/blob/2.1/applications/dashboard/views/user/users.php#L37-38

In the index.php I can add my TH tag and in the users.php I can add my user data. Sounds good, but I can't manage to get it working. My first problem has been to determine which of both Events is called. I've take that approach:

    public function userController_userCell_handler ($Sender) {
        if (!isset($Sender->EventArguments['User'])) {
            echo '<th>rubbish</th>';
        } else {
            echo '<td>'.$Sender->EventArguments['User']->Name.'</td>';
        }
    }

In the users.php the current user is passed as a EventArgument. If it is not set, I must be in the index.php, and if it is set, I can show some information from the User object.
To my big surprise, I have no entry in the first row, and in the second row I see the name of user one in my "rubbish" column! I keep staring at the code but cannot find any solution for that.

Can anyone explain to me why this is happening?

Answers

  • HA! It's a typo in Vanilla! They wrote EventArgs while it must be EventArguments and the User is set later on correctly as an EventArguments and that's why it appears as shifted! BINGO!

    So please forget my question.

Sign In or Register to comment.