Support » Plugin: WPAdverts - Classifieds Plugin » Send message to administrator, not the author

  • Resolved davideroppo

    (@davideroppo)


    Hi,
    I would like to know if it’s possible to set the contact form in detail add page so that interested person can send automatically the message to site owner ?

    Also, if I buy the custom fields addon, can I remove fields like price and location ?

    I just need people to upload ad advert, let other people express interest and eventually interact but always through the site admin. Seller and buyer have not to get in contact directly.

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. you can route the emails sent from the contact form to the administrator by adding the code below in your theme functions.php file

    
    add_filter( "adverts_contact_form_email", "contact_form_email", 10, 3 );
    function contact_form_email( $mail, $post_id, $form ) {
        // Send all the emails to Administrator
        $mail["to"] = get_option( "admin_email" );
        return $mail;
    }
    

    2. yes, you can remove price and location fields using Custom Fields extension (the only two fields that cannot be removed are Title and Contact Email).

    That being said if the only customization you are looking to do is to remove the fields then you can do that by adding the code below in your theme functions.php file, you do not need Custom Fields add-on

    
    add_filter( "adverts_form_load", "customize_adverts_add" );
    function customize_adverts_add( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( in_array( $field["name"], array( "adverts_location", "adverts_price" ) ) ) {
            unset( $form["field"][$key] );
        }
      }
      return $form;
    }
    

    Hi Greg,
    thank you very much for your answers.
    Just another question: is it possible to see an excerpt of the advert description in adverts’ list ? I haven’t found any addon to do this.

    I just made your suggested modifications, but the email the site administrator receives is unuseful: sender name is the label ok the field “your email”, email address is the same of the website administrator and there’s no id, or title, or publisher of the ad.

    So, when the administrator receive the message, he basically doesn’t know anything about who is interested in the ad, and how to reach him.

    I would really buy the custom form addon or any other that can help me to solve this.
    Thank you.

    Plugin Author Greg Winiarski

    (@gwin)

    1. to add the excerpt to the items in [adverts_list] you would need to edit the wpadverts/templates/list-item.php template file.

    Note that the changes you will make in the list-item.php file will be overwritten on WPAdverts update, in order to avoid it consider creating a child template file for list-item.php as explained here https://wpadverts.com/documentation/child-themes-and-templates/

    2. you can customize the message sent by the contact form using adverts_contact_form_email filter, please see https://github.com/simpliko/wpadverts-snippets/blob/master/contact-form-email/contact-form-email.php for more details.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.