How can i hide contact details to the logged out users?

How can i hide contact details to the logged out users?

Please clarify what is contact details? Do you mean some custom listing/vendor attribute or something else?

Yes.i would like to hide some attributes of my listings to those who are not logged in

Please try this PHP snippet. Please change attribute_name text in a snippet on the slug/field name of the attribute to which you want to add this restriction

	function( $attributes ) {
		if ( isset( $attributes['attribute_name'] ) && !is_user_logged_in() ) {
			$attributes['attribute_name']['display_format'] = 'Login to view';
		return $attributes;
1 Like

Thank you.i created a link to login page in the place of “login to view” .but there is a problem that when a user is redirected to login page,he logs in and goes to the main page.but how can we redirect the user to the same post after login?

Please try linking to the user login modal instead of the page, in this case, e.g. if you set the “#user_login_modal” URL then it’ll open the modal window and it’ll redirect users to the same page after login.

ok thank you it how can i verify users with mobile number instead of email address in registration form?

If you mean using phone numbers instead of emails for logging in and registration unfortunately there’s no such feature yet, but we plan to add it either as a core feature or as an extension.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.