Support » Plugin: WPAdverts - Classifieds Plugin » Contact Form Module

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

    (@gwin)

    You can do this using adverts_form_load filter

    
    add_filter( "adverts_form_load", "customize_form_8180241" );
    function customize_form_8180241( $form ) {
        if( $form['name'] != "contact" ) {
            return $form;
        }
        foreach( $form["field"] as $key => $field ) {
            if( $field["name"] == "message_subject" ) {
                $form["field"][$key]["label"] = "Advert Title";
            }
        }
        return $form;
    }
    

    Just paste the code above in your theme functions.php file.

    Thread Starter eKnizky

    (@eknizky)

    Sorry. I was thinking change subject not change text. Something like that.

    // Include Advert title in the subject
    $mail[“subject”] = $post->post_title . ” – ” . $mail[“subject”];

    https://github.com/simpliko/wpadverts-snippets/blob/master/contact-form-email/contact-form-email.php

    Plugin Author Greg Winiarski

    (@gwin)

    Ohh ok, to force the title to be always the ticket title, then you need to modify the function from GitHub to look like this

    
    function contact_form_email( $mail, $post_id, $form ) {
        $post = get_post( $post_id );
        $mail["subject"] = $post->post_title;
        return $mail;
    }
    

    The the email title will be always the same as Ad title.

    Sorry to bump an old old Greg but any chance we can do the same with BuddyPress? Currently when you press ‘Private Message’ it adds them to the ‘Send To’ field but has an empty title.

    I’d love a ‘Regarding the [Insert Ad Title Here]

    Thanks,
    Graham

    Plugin Author Greg Winiarski

    (@gwin)

    I am actually looking for a way to embed the BP contact form somehow on the Ad details page, most likely this will be implemented in one way or another (or maybe even integrated with the default contact form), but right now i cannot tell when it will be ready.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Contact Form Module’ is closed to new replies.