Hide contact info from unregistered visitors

This topic contains 4 replies, has 3 voices, and was last updated by  Luca 5 years ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #478808

    Luca
    Expired Member
    Post count: 23

    Hi,
    With the V1 version of your plugin I had implemented some custom code to prevent emails of listing authors from being displayed to the public. Website visitors could only see email or phone contact info IF they were logged in. This is VERY important to us, so I would really appreciate knowing how to re-implement the same functionality in V2!
    Also, I don’t see any options for visitors to contact listing authors via a form on the website – why did that option disappear, and how do I bring it back?
    Thanks!

    Previous code which was working fine on V1:

    function _gdPB_hide_email_setup() {
    	if ( is_user_logged_in() ) {
    		return;
    	}
    	$fields = array();
    	$fields[] = 'geodir_email';
    	// ADD MORE FIELDS HERE
    	if ( ! empty( $fields ) ) {
    		foreach ( $fields as $field ) {
    			add_filter( 'geodir_show_' . $field, '_gdPB_hide_email', 10, 2 );
    		}
    		}
    }
    function _gdPB_hide_email( $html, $params ) {
    	if ( ! is_user_logged_in() ) {
    			$html = 'Log in to send message.</br>' ;
    			return $html;
    		} 
    } 
    add_filter( 'init', '_gdPB_hide_email_setup', 10 );
    #478812

    Guust
    Moderator
    Post count: 29970

    By default, emails of authors are never displayed, so I guess you have added an email custom field?

    You can add the contact form by adding the GD > Ninja Forms widget to the Detail page sidebar.

    https://wpgeodirectory.com/docs-v2/integrations/ninja-forms/

    #478910

    Luca
    Expired Member
    Post count: 23

    My setup is basically the same as I had it on V1, but it stopped working! It’s nice to have the email custom field so users can get in touch directly, since we’re a swap site… AND I would have the exact same problem/question about the Ninja Forms Widget. The intended use is to have visitors register before they can contact a listing author. How would I then make the Ninja Form accessible only to logged in visitors?

    PS – This is EXTREMELY frustrating, and I can’t believe such a simple functionality as sending messages is no longer included in your expensive premium plugin.

    #478923

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Luca,

    The geodir_ prefix has been removed so in your code change

    $fields[] = 'geodir_email';

    to

    $fields[] = 'email';

    For ninja forms there is a few ways to do it, like if u want to hide the button or show a new message in the popup..

    The reason we removed the contact form functionality is that is was one of the most common feature requests, to be able to edit field so we assessed all the contact form builder and added what we think is the best (more will follow).

    Thanks,

    Stiofan

    #479335

    Luca
    Expired Member
    Post count: 23

    Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket