Plugin Directory

Opened 6 years ago

#2827 new enhancement

Notice in function: wp_user_avatars_meta_caps at capabilities

Reported by: bschaeffner's profile bschaeffner's profile bschaeffner Owned by:
Priority: high Severity: normal
Plugin: not-listed Keywords: capabilitie
Cc:

Description

Hello,

i got this php "error" from your wp_user_avatars-plugin:
Notice: Undefined offset: 0 in ../plugins/wp-user-avatars/wp-user-avatars/includes/capabilities.php on line 39

I found the reason at the user_can function, because the function not handles arguments:

<?php
   if ( user_can( $user_id, 'edit_user', $args[0]) ) {
      $caps = array();
   }

I think this will be fix the notice, because arguments not supported in the wordpress user_can function.

<?php
   if ( user_can( $user_id, 'edit_user') ) {
      $caps = array();
   }

This is the user_can function from wordpress:

<?php
/**
 * Whether a particular user has a specific capability.
 *
 * @since 3.1.0
 *
 * @param int|WP_User $user       User ID or object.
 * @param string      $capability Capability name.
 * @return bool Whether the user has the given capability.
 */
function user_can( $user, $capability ) {
   ...
}


Would be nice, if you can fix this.

Regards,
Brian

Change History (0)

Note: See TracTickets for help on using tickets.