Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter BackuPs

    (@backups)

    nope that also did not fix it

    Thread Starter BackuPs

    (@backups)

    its caused by

    && author_can( get_the_ID(), 'administrator' )
    

    sorry

    Thread Starter BackuPs

    (@backups)

    wrong code

    Thread Starter BackuPs

    (@backups)

    Hi

    here is the real fix to this issue dealing with all options and settings and get rid of the notice.

        static public function disable_author_page() {
            $authorrequest = FALSE;
            $request = ( isset( $_SERVER[ 'REQUEST_URI' ] ) ? $_SERVER[ 'REQUEST_URI' ] : $_SERVER[ 'SCRIPT_NAME' ] . ( ( isset( $_SERVER[ 'QUERY_STRING' ] ) ? '?' . $_SERVER[ 'QUERY_STRING' ] : '') ) );
            if ( is_404() && stripos( $request, '/author/' ) == 0 ) {
                if ( get_option( 'disable_author_pages_redirect_non_authors' ) == 1 ) {
                    $authorrequest = TRUE;
                }
            }
    		if ( is_404() && stripos( $request, '/author/' ) === false ) {
    			return;
    		}
    
            if ( ( is_author() || $authorrequest ) && get_option( 'disable_author_pages_activate' ) == 1 ) {
                $adminonly = get_option( 'disable_author_pages_adminonly', '0' );
    			$author_can=false;
    
    			if (!is_404() && $adminonly) {
    					global $post;
    					if( is_object($post)) {
    						$author_can = author_can( get_the_ID(), 'administrator');
    					}
    			}
    
                if ( $adminonly && $author_can===true || !$adminonly && !is_404() || is_404() && ( get_option( 'disable_author_pages_redirect_non_authors' ) == 1 ) ) {
                    $status = get_option( 'disable_author_pages_status', '301' );
                    $url = get_option( 'disable_author_pages_destination', '' );
                    if ( $url == '' ) {
                        $url = home_url();
                    }
                    wp_redirect( $url, $status );
                    exit;
                }
            }
        }
    

    Best regards,

    Plugin Author Frank Neumann-Staude

    (@fstaude)

    Hi BackuPs,

    thanxs for the code.

    i update the plugin now

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘notice warning. can you pls fix?’ is closed to new replies.