Support » Plugin: WPAdverts - Classifieds Plugin » Send Messaging, Private Messaging Functionality.

  • Resolved jak0works



    Topic: Send Messaging, Private Messaging Functionality.

    Under new GDPR regulations in europe we are trying to minimize customer data exposure and getting the customer to do the least amount of work when messaging.

    With the default setting in wp-adverts it exposes phone number and email of users that post adverts, this can be changed by:

    Enabling the wp-adverts Contact Form
    – which displays a contact form instead of contact details (Send Message).

    This is step in the right direction for us, so we enabled Private Messaging through the wp-advert buddy press intergration plugin, great feature!.

    We would now like to disable:

    1) Send Message
    2) Show Contact Details

    And just have a Private Message button. We already looked at the general plugin customization as advised through the wp-advert docs with excellent guide

    It appears that:

    function ‘adverts_single_contact_information( $post_id )’
    – located in ‘functions.php’, callback for ‘do_action(‘adverts_tpl_single_bottom’, $post_id)’
    – located in in ‘/templates/single.php’

    If the do action is removed from single.php it also removes all messaging + Private Messaging feature which we want to keep.

    If we replace the contents of the function ‘adverts_single_contact_information( $post_id )’ and just have it return an empty div <div></div> then it seems to do the job. The trouble is if the wp adverts plugin is updated it will return to displaying the contact form or worse the contac details. not good!

    The end goal is to have a a ‘Private Message’ button only at the end of the adverts page and when selected populates the ‘send to’ field with the advert sellers @username
    ready to go!


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


    Hi, in order to have just the BP Private Message button in the Ad details page you can add the code below in your theme functions.php file

    add_action( "init", "only_bp_contact_on_ad_details", 50 );
    function only_bp_contact_on_ad_details() {
        remove_action( 'adverts_tpl_single_bottom', 'adverts_single_contact_information' );
        remove_action( 'adverts_tpl_single_bottom', 'adext_contact_form' );
    Thread Starter jak0works


    Hi Greg,

    Thanks for the quick response that’s the action what we were looking for.

    2 questions related..

    Will functions.php be overwritten when the theme is updated losing the modification, if so can we put this in a plugin instead?

    When a user selects the Send Private Message button on an advert, can the Send Username be populated with the advert Sellers Username and Subject filled with the title of the advert? less hassle and things to do for the buyer messaging the seller!

    Thank you

    • This reply was modified 2 years, 12 months ago by jak0works.
    Plugin Author Greg Winiarski


    1. yes, on theme update the functions.php file will be overwritten, to avoid that you can either keep the code in child-theme functions.php or create a new WP plugin and put the code there.

    2. for logged in users it is possible to set the subject, dynamically, it will also be possible for not logged in users in next WPAdverts release, you can do that with the code below

    add_action( "adverts_form_bind", "my_contact_form_bind", 10, 2 );
    function my_contact_form_bind( $form, $data ) {
        $post = get_post( get_the_ID() );
        $form->set_value( "message_subject", $post->post_title );
        return $form;

    You can use line $form->set_value( "field_name", "1" ); to set values for other fields in the contact form.

    Thread Starter jak0works


    Yea thanks for that we implemented a child theme for these actions.

    The first action works great just displaying the Send Private Message.
    The second action to Populate the Fields in the Private Messages Form:

    add_action( “adverts_form_bind”, “my_contact_form_bind”, 10, 2 )

    has no affect yet.

    When a logged in user clicks on or hovers over the “Send Private Message” button on an advert post we see the url:


    When clicked it does not land on the Compose Page, It appears to land on Messages with the (i) Sorry, no messages were found. Obviously empty messages inbox.

    If you then click on Compose it shows the contact form (fields not populated) we see the url:



    • This reply was modified 2 years, 11 months ago by jak0works.
    Thread Starter jak0works


    Sorry about the incorrect links above they should be as below.

    When User Selects Send Private Message, the url is:

    Lands on messages then has to click compose to see contact form, the url is:

    Plugin Author Greg Winiarski


    Hi, i am afraid it is only possible to prefill fields in Contact Form (the one sent via email), it is not really possible to prefill the details in BuddyPress contact form because WPAdverts BP only links to a page where the user can send a message.

    In next WPAdverts BP release the link will be replaced with an actual form to send a private message, then it will be possible to prefill the inputs in the form.

    Thread Starter jak0works


    Hi, ok that’s great, we look forward to the update / release.

    Thank you for the support.


    Thread Starter jak0works



Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Send Messaging, Private Messaging Functionality.’ is closed to new replies.