Title: Query monitors alerts about 2 PHP errors
Last modified: October 20, 2023

---

# Query monitors alerts about 2 PHP errors

 *  [sacconi](https://wordpress.org/support/users/sacconi/)
 * (@sacconi)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/query-monitors-alerts-about-2-php-errors/)
 * NoticeUndefined variable: user+
    1. wp-content/themes/sacconicase/functions.php:699
 * 1TemaNoticeTrying to get property ‘ID’ of non-object+
    1. wp-content/themes/sacconicase/functions.php:699
 * 1Tema
 * NoticeUndefined variable: user+
    1. wp-content/themes/sacconicase/functions.php:703
 * 1TemaNoticeTrying to get property ‘ID’ of non-object+
    1. wp-content/themes/sacconicase/functions.php:703
 * Line 699 is:`$german = get_the_author_meta('periodo_affitti_de', $user->ID );`
 * inside
 *     ```wp-block-code
       add_shortcode('periodo_affitti', 'translate_rent');
       function translate_rent() {
         global $post;
         $german = get_the_author_meta('periodo_affitti_de', $user->ID );
         if ( 'de_DE' == get_locale() && ! empty( $german )){
            return $german;
         } else {
            return get_the_author_meta( 'periodo_affitti', $user->ID ) ;
         }
       }
       ```
   
 * Line 703 is inside the same function
 * When I have “return” I dont know how to fix the function
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fquery-monitors-alerts-about-2-php-errors%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/query-monitors-alerts-about-2-php-errors/#post-17139238)
 * You would need to assign a WP_User object to $user. It should be the post’s author,
   right? If so, instead of getting a WP_User object, replace `$user->ID` with `
   $post->post_author`

Viewing 1 replies (of 1 total)

The topic ‘Query monitors alerts about 2 PHP errors’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/query-monitors-alerts-about-2-php-errors/#post-17139238)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
