Support » Plugin: WPAdverts - Classifieds Plugin » After a plugins update the urls have changed for messaging

  • Resolved jak0works

    (@jak0works)


    Latest Installed Related Plugin Versions:
    BuddyPress Version 3.0.0
    WP Adverts Version 1.2.4
    WP BuddyPress Integration Version 1.0.2

    We noticed after a plugins update the urls have changed for messaging which has misplaced where the user is sent to when they click on the Send Private Message button on an advert post.

    Actual url Link to message compose page for Old Plugin Version.
    /members/user1/messages/compose/

    Actual url Link to message compose page for New Plugin Version.
    /members/user1/messages/#compose

    When a user clicks on Send Private Message to user JMB they are sent to
    /members/user1/messages/compose/?r=JMB&_wpnonce=a082ef325b

    This appears to be incorrect as it does not land on the compose page and lands on the main messages page.

    If as a test we just manipulate the url to reflect the New Plugin Version “/#compose” instead of “/compose/” then the link does land on the compose page as should be.

    Manipluated url
    /members/user1/messages/#compose?r=JMB&_wpnonce=a082ef325b

    Lands correctly!

    It appears the Send Private Message button is still using the old plugin version url format “/compose/” Is it possible to have this corrected to reflect “/#compose”.

    Thank you,
    J

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

    (@gwin)

    Hi, thanks for the heads up, you should be able to update the URL in “Send Private Message” button by adding the code below in your theme functions.php file

    
    add_filter( "bp_get_send_private_message_link", "my_bp_get_send_private_message_link" );
    function my_bp_get_send_private_message_link( $url ) {
      $url =  bp_loggedin_user_domain() . bp_get_messages_slug() . '/#compose/?r=' . $user->user_login;
      return wp_nonce_url( $url );
    }
    

    The same update should be in next WPAdverts BP release.

    Thread Starter jak0works

    (@jak0works)

    Thanks for the update just a couple of points to highlight with this filter as it think its nearly there but not yet..

    Logged In User: jak0works
    Sending Private Message To: jillH

    What the URL should look like. Works correctly.
    /members/jak0works/messages/#compose?r=jillH&_wpnonce=cbbdcaa085

    With the add filter() from this thread, what the url looks like:

    URL:
    /members/jak0works/messages/?_wpnonce=cbbdcaa085#compose/?r=

    It appears that the way the url is being constructed in the filter callback function is incorrect.

    – still has the / after compose.
    – appears the url order is wrong.
    – shouldn’t we be getting the user we want to send a private message to and not legged in user. If we use $user_info->user_login the url has r=jak0works where as it should be r=jillH.

    we are nearly there šŸ™‚

    Thanks for the support
    J

    Plugin Author Greg Winiarski

    (@gwin)

    Please try this functions instead

    
    add_filter( "bp_get_send_private_message_link", "my_bp_get_send_private_message_link" );
    function my_bp_get_send_private_message_link( $url ) {
      return str_replace( '/compose/', '/#compose/', $url );
    }
    
    Thread Starter jak0works

    (@jak0works)

    Ok so we tried this but unfortunately we still see the landing page incorrect. I suspect the incorrect path we mentioned earlier is still being used as a solution.

    Thank you
    J

    Plugin Author Greg Winiarski

    (@gwin)

    You might need one more change in the code

    
    return str_replace( '/compose', '/#compose/', $url );
    

    this should replace the link correctly, in either case, you should be able to use this line of code to manipulate the private message link generated by WPAdverts BP and adjust it to your needs.

    Thread Starter jak0works

    (@jak0works)

    Ok thank you for the update on this, our needs are simple really we purchase a paid plugin, we and the end user base / customers expect it to work 100%. We do understand other dependent plugins can change but, this is highlighting issues we will see for sure in the future with wp-adverts plugins. We look forward to the official fix and plugin update for this as str_replace() is a band aid not a fix.

    Thank you
    J

    Plugin Author Greg Winiarski

    (@gwin)

    This is true the fix i am proposing is just a band-aid to have the BP integration working as soon as possible, once we will release an update, which should be this week, you will no longer need it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘After a plugins update the urls have changed for messaging’ is closed to new replies.