When a logged out visitor opens the add listing page, GeoDirectory shows “You must login to post.” with Login and Register links. GeoDirectory does not have its own login system and has no redirect setting for this, but you can change the message or redirect the visitor with a short snippet.
Change the message
Edit your add listing page and open the GD > Add Listing block settings. In the Login group, change Login Message, and untick “Show the login and register links if required” if you do not want the links.
Redirect to your own login page
This snippet sends logged out visitors from the add listing page to a page of your choice, for example a page with a login form and a registration form side by side. Replace /login-or-register/ with your page’s address.
add_action( 'template_redirect', function() {
if ( is_user_logged_in() || geodir_get_option( 'post_logged_out' ) ) {
return;
}
if ( geodir_is_page( 'add-listing' ) ) {
$back = geodir_curPageURL();
wp_safe_redirect( add_query_arg( 'redirect_to', rawurlencode( $back ), home_url( '/login-or-register/' ) ) );
exit;
}
} );
The redirect_to parameter holds the add listing address. Whether visitors are sent back after logging in depends on your login form: forms that support redirect_to will return them to the add listing page.
The snippet does nothing if you have turned on “Allow posting without logging in?” in GeoDirectory > Settings > General.