• Resolved Aditya Agarwal

    (@adityamilyin)


    Hi there, I have many times seen that viewers of my blog like to send up message to the creator of post, and end up doing that contact us thing. As my site has many users (over 600) they love to chat among each other, for the fact that this plugin has lot of functionality.

    But is there possible to have a way where a button to chat with author of the post can be shown. i mean when we click the button, it takes us to new message page with the name of author already filled in.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author wordplus

    (@wordplus)

    Hi there!

    Yes, its possible to add send message button to any place with custom code!

    Thanks!

    Thread Starter Aditya Agarwal

    (@adityamilyin)

    oh wonderful, what is that beautiful line of code that i need to insert in the posts so that the button directs users to chat with username filled as post author.

    could you please provide me with the code, or link to a page where this code is given.

    Plugin Author wordplus

    (@wordplus)

    take it!

    $link_to_new_message_screen = BP_Better_Messages()->functions->get_link() . '?new-message&to=' . bp_core_get_username( $user_id );

    Thread Starter Aditya Agarwal

    (@adityamilyin)

    oh that was quick. thanks a lot!! will try and let you know soon

    Thread Starter Aditya Agarwal

    (@adityamilyin)

    sorry but did not work for me. I have for test put the code on page https://milyin.com/creations/10759/

    and the page is blank. i have used ad inserter plugin and added it as a block with php execusion enabled. as you can see the whole page is wrong.

    Please help me on it.

    Hi Aditiya Agarwal you can also write like this https://yoursitename.com/private-chat-page/?new-message&to=<?php the_author_meta( ‘user_login’ ); ?> this is working properly 🙂

    Hi,
    That works very well. But is it possible to add subject into link too? How could you do this?
    Thanks a lot
    Regards

    Thread Starter Aditya Agarwal

    (@adityamilyin)

    so i got it to work to some extent. I wrote the custom code written below. The code echos a link and i think that is fine.

    <?php
    echo ‘< a href=”‘.site_url(‘chat/’).’?new-message&to=’.get_the_author_meta( ‘ID’).'” > Chat < /a >’; ?>

    https://milyin.com/chat/?new-message&to=6/

    Here 6 is the user id, and chat is the page. Is this URL correct. because it populates the ‘send to’ field with userid (6) rather than the user name and display name. Moreover clicking send button leads it getting reloaded.

    • This reply was modified 7 years, 2 months ago by Aditya Agarwal. Reason: the code had a typo
    Thread Starter Aditya Agarwal

    (@adityamilyin)

    based on what @wordplus and @kawish001 suggested, i got the code to finally work right. This is what i coded, this works fine for me.

    echo ‘< a href=”‘.site_url(‘chat/’).’?new-message&to=’.get_the_author_meta( ‘user_login’ ).'” > Chat < /a > ‘;

    • This reply was modified 7 years, 2 months ago by Aditya Agarwal. Reason: typo
Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Send Message To Author’ is closed to new replies.