• Resolved zxkirazx

    (@zxkirazx)


    Hi. User submitted adverts are not working properly when the buddypress integration is activated. After the user tries to publish the advert after preview, it will bring them to a page that said Add, without “Thank you for submitting your ad!
    Your ad has been published. You can view it here “aa”.”

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

    (@gwin)

    Hi, most likely there is some kind of error, try adding this line in your wp-config.php file define("WP_DEBUG", true); and try posting the Ad again, it should show an error message.

    Thread Starter zxkirazx

    (@zxkirazx)

    Hi. There was no error message, just something like this.

    • This reply was modified 7 years, 11 months ago by zxkirazx.
    Plugin Author Greg Winiarski

    (@gwin)

    Hi, hmm are you using some Adblocker in your browser? If so try disabling it and see if this helps.

    Also, the image you linked does not really show much.

    Thread Starter zxkirazx

    (@zxkirazx)

    I was not using any adblock. Everything works fine if i deactivate the buddypress integration plugin

    Plugin Author Greg Winiarski

    (@gwin)

    Ok, in BuddyPress wp-admin / Settings / BuddyPress please check if you have “Activty Strams” enabled if you do not then enable them this should fix it.

    In next BP Integration release, it will be possible to disable “Activity Streams”.

    Thread Starter zxkirazx

    (@zxkirazx)

    My “Activity Streams” was enabled but the problem still persists

    Plugin Author Greg Winiarski

    (@gwin)

    I am not sure than, we never had such problem before, can you send me a message via contact form here https://wpadverts.com/contact/, i would need some more debugging info.

    Thread Starter zxkirazx

    (@zxkirazx)

    Hi.
    I went into wpadverts-bp/wpadverts-bp.php and changed line 484 to false and it works. May I ask if is it the right way to do it?
    This was the line that i edited:
    $activity = get_post_meta( $post_id, “wpadverts_bp_activity_add”, true );

    Another quick question. Is there any way i can add a small dropdown/icon beside the grid/list icon that can allows the users to filter the adverts from highest price to lowest price etc. There is a date filter which you commented out. Is it possible to combine that and
    add_filter( “adverts_list_query”, “my_adverts_sort_by_title” );
    function my_adverts_sort_by_title( $args ) {
    $args[“orderby”] = array( ‘title’ => ‘ASC’, ‘menu_order’ => ‘DESC’, ‘date’ => ‘DESC’ );
    return $args;
    }
    to make the filter?

    Thank you.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. that is not really the correct way to do it, with this change it is now impossible to record new activity in BP when users posts an Ad, instead of this change after

    
    if( $activity > 0 ) {
        // Activity already recorded
        return;
    }
    

    add

    
    if ( ! bp_is_active( 'activity' ) ){
         return;
    }
    

    this is how this issue will be resolved in next BP release, although you wrote you have the BP Activity enabled, so this issue should not occur in the first place.

    Anyway if this won’t work you can add following code in theme functions.php it will disable adding activity by WPAdverts

    
    add_action( "init", "disable_wpadverts_bp_activity", 1000 );
    function disable_wpadverts_bp_activity() {
        remove_action( 'publish_advert', 'adext_bp_activity_add' );
    }
    

    2. the icon you would need to add directly in wpadverts/templates/list.php file, if you combine the icon with the code you posted it should allow you to custom sort the list.

    Thread Starter zxkirazx

    (@zxkirazx)

    Plugin Author Greg Winiarski

    (@gwin)

    Hi, the code you pasted you need to add in your theme functions.php file or create a new plugin in paste it there, adding it in list.php will not do anything as when the template ile is loaded the adverts_list_query filter is already executed.

    Thread Starter zxkirazx

    (@zxkirazx)

    Hi. One last question, if I pasted the code in a new plugin and the button is in list.php. How can I set it such that when the button is pressed, the new plugin will execute the add_filter? Onclick event handler does not work and gave me error.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi, i am not exactly sure what you are trying to do, the function my_adverts_sort_by_title() you need to have in your theme functions.php file, in the same file you also need to have this line

    
    add_filter( "adverts_list_query", "my_adverts_sort_by_title" );
    

    it will apply additional sorting, this does not happen on click but (as the code is now) every time [adverts_list] Ads are loaded.

    Thread Starter zxkirazx

    (@zxkirazx)

    Actually, I wanted to add a button beside the grid/list button in the search bar. Such that it will sort the adverts by date on click. Could you help me with that?

    Plugin Author Greg Winiarski

    (@gwin)

    Basically to do that you need a HTML button in wpadverts/templates/list.php file

    
    <a href="<?php echo esc_html( add_query_arg( "sort", "title" ) ) ?>">Sort By Title</a>
    

    The button should redirect to current page URL with GET parameter (for example named “sort” added) so the function my_adverts_sort_by_title() will know that the custom sorting should be enabled.

    
    add_filter( "adverts_list_query", "my_adverts_sort_by_title" );
    function my_adverts_sort_by_title( $args ) {
        if( adverts_request( "sort" ) == "title" ) {
            $args["orderby"] = array( 
                "title" => "ASC", 
                "menu_order" => "DESC", 
                "date" => "DESC" 
            );
        }
        return $args;
    } 
    

    The code above should go to your theme functions.php file, now when you click “Sort By Title” button you will be redirected to the page which will have &sort=title in the URL, then the my_adverts_sort_by_title function will know that sorting by title should be enabled.

    If you do not have at least some experience with PHP and HTML then I am afraid you might not be able to do that yourself and you will need to hire a freelancer to do that for you.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Buddypress Integration not working’ is closed to new replies.