How to show parent pages on a specific page if user is logged in?

The database hasn’t been queried yet on init, there is no $post or $wp_query. See the Action Reference for the order actions are executed. Try moving your code to the template_redirect action.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)