• Resolved idpokute

    (@idpokute)


    Hello.
    I’ve met an issue that throws php error. Maybe this is an edge case.

    Here is the file location.
    plugins/yet-another-related-posts-plugin/lib/plugin-deactivation-survey/deactivate-feedback-form.php

    line # 63

    if ( $current_user->roles[0] ) {
    	$role = $current_user->roles[0];
    }
    

    The first item of roles doesn’t use index 0 in some cases. In my case, it is 12. So it should use the first element, not using index 0.

    if ( ! empty( $current_user->roles ) ) {
    	$role = reset( $current_user->roles );
    }
    • This topic was modified 4 years, 3 months ago by idpokute.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘bug fix for role related code.’ is closed to new replies.