Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #52076, comment 24


Ignore:
Timestamp:
04/08/2021 08:44:11 AM (3 years ago)
Author:
juliobox
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #52076, comment 24

    initial v1  
    1212
    1313But I guess that there is also other cases with plugins doing "user_can( $id, 'exist' ) // false" and expecting this to be false! And this is a game changer now.
    14 I checked the wp repo and I have to admit that I didn't find even 1 plugin where this could cause a bug because they all check if the $user is a WP_User first (https://wpdirectory.net/search/01F2Q4CJTZFV747PPKFMQR5X53). This leads us to the second part of my comment…
     14
     15We should keep the possibility of a return false like before:
     16{{{#!php
     17<?php
     18        if ( ! $user || ! $user->exists() ) {
     19                return false;
     20        }
     21}}}
     22Because a "false user" is not the same as a "logged-out user". So a fake one does not exists.
     23Still I agree that a current_user_can( 'exists' ) should always return true, because I mean… I'm the current, so I exist.
     24
     25Then I've checked the wp repo and I have to admit that I didn't find even 1 plugin where this could cause a bug because they all check if the $user is a WP_User first (https://wpdirectory.net/search/01F2Q4CJTZFV747PPKFMQR5X53). This leads us to the second part of my comment…
    1526
    1627**…since we are here now**, I would like to suggest to change this: