• 1. Is it possible to change the default Expiry date based on the user role?
    2. How do I change the default Expiry Date to 7 days instead of 30 Days?
    3. Is it possible to show the contact information to only Logged in Users?
    4. Do you have a filter to remove the search from the listing page?
    5. How do I change the default Listing permalink from abc.com/adverts/my-car/ to abc.com/forsale/my-car/ ?

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

    (@gwin)

    Hi,
    1. i am afraid not, at least not without some custom programming.

    2. you can change it in wp-admin / Classifieds / Options / Core panel

    3. to do that you can add the code below in your theme functions.php file

    
    add_filter( "wp", "paying_members_only_init", 50 );
    function paying_members_only_init() {
        if( is_singular( 'advert' ) && !current_user_can( "read" ) ) {
            remove_action( 'adverts_tpl_single_bottom', 'adverts_single_contact_information' );
            remove_action( 'adverts_tpl_single_bottom', 'adext_contact_form' );
            remove_action( 'adverts_tpl_single_bottom', 'adext_bp_send_private_message_button', 50 );
    
            add_action( 'adverts_tpl_single_bottom', "paying_members_only", 5 );
        }
    }
    function paying_members_only( $post_id ) {
        $flash = array( "error" => array(), "info" => array(), "warn" => array() );
        $flash["warn"][] = array(
            "message" => __( "Only logged-in can contact sellers." ),
            "icon" => "adverts-icon-block"
        );
        adverts_flash( $flash );
    }
    

    4. you mean to hide the search bar on the [adverts_list]? If so then you can do that by using the shortcode with search_bar=”disabled” param like this

    
    [adverts_list search_bar="disabled"]
    

    See the docs here https://wpadverts.com/doc/creating-ads-list-adverts_list/ for more details.

    5. you can do that using the adverts_post_type filter, please see the snippet here for more details https://github.com/simpliko/wpadverts-snippets/blob/master/custom-slugs/custom-slugs.php

    How to best install the snippet you can read here https://github.com/simpliko/wpadverts-snippets/ at the bottom of the page.

    Thread Starter Saptak

    (@tatai1985)

    Excellent Plugin Greg and Thanks again for replying quickly.

    ##Do you have an action hook when saving the ad? So it can be used to dynamically add an expiry date?

    ## I also saw that you used remove_action( 'adverts_tpl_single_bottom', 'adext_bp_send_private_message_button', 50 ); in your earlier snippit. So do you have a Personal messaging functionality ?

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

    (@gwin)

    1. if you are not using Payments Module or the WooCommerce integration then you can use the wpadverts_advert_saved action to change the expiration date when the Ad is saved as pending/published.

    
    add_action( "wpadverts_advert_saved", function( $post_id ) {
      update_post_meta( $post_id, "_expiration_date", strtotime( "NOW +5 DAYS" ) );
    } );
    

    This will of course change the expiration date for all the ads to 5 days in the future you would need to customize it to have a different value for each role.

    One thing to keep in mind is that the value for _expiration_date should be a timestamp.

    2. the line you quoted disables the contact form created by WPAdverts BP integration.

    If you have the BP integration then you can show a contact form on Ad details page which will start a conversation with the Ad owner via the BuddyPress private messages.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default Advert Expiry Date’ is closed to new replies.