Skip to:
Content
Pages
Categories
Search
Top
Bottom

subject in private message


  • acengiz
    Participant

    @acengiz

    Hello,

    I add a private message button to listings by using below function, but in subject field “Testing” does not appear. Am i missing something? Actually, i want to get listing title into the subject field. Any suggestions?

    function bp_custom_get_send_private_message_link() {
    $author = get_the_author();
    $subject =”Testing”;
    $compose_url=bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/compose/?’;
    if($author)
    $compose_url.=(‘r=’ . get_the_author());
    if($subject)
    $compose_url.=(‘&subject=’. $subject);
    return wp_nonce_url( $compose_url ) ;
    }

    add_shortcode( ‘ksam2’, ‘bp_custom_get_send_private_message_link’ );

    Best regards

Viewing 9 replies - 1 through 9 (of 9 total)

  • shanebp
    Moderator

    @shanebp

    Create a template overload of this file:
    buddypress\bp-templates\bp-legacy\buddypress\members\single\messages\compose.php

    And adjust the subject input field so that it looks for your $_GET variable.


    acengiz
    Participant

    @acengiz

    Hi shanebp,

    Thanks for help. I adjusted like this, still not working and also i am not sure this is ok:

    <form name=”form” action=”” method=”get”>
    <input type=”text” name=”subject” id=”subject” value=”<?php bp_messages_subject_value(); ?>” />
    </form>

    What do you think?

    BR. Anil


    shanebp
    Moderator

    @shanebp

    Please use the code button when sharing code.

    Why would you add a form tag? Don’t.

    <input type="text" name="subject" id="subject" value="<?php if ( isset( $_GET['subject'] ) ) echo $_GET['subject']; else bp_messages_subject_value(); ?>" />


    acengiz
    Participant

    @acengiz

    Hi again, do i need to change anything in below function?

    function bp_custom_get_send_private_message_link() {
    $author = get_the_author();
    $subject="Testing";
      
    $compose_url=bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?';
    if($author)
    $compose_url.=('r=' . get_the_author());
    if($subject)
    $compose_url.=('&subject='. $subject);
      
    return wp_nonce_url( $compose_url ) ;
    }
    

    shanebp
    Moderator

    @shanebp

    do i need to change anything in below function?

    Maybe – it needs to output an url like this:
    http://yourdomain.com/members/acengiz/messages/compose/?r=member-login-name&subject=Testing&_wpnonce=d5e2ace8d7

    r needs to be the login name of that member.


    acengiz
    Participant

    @acengiz

    Hey shanebp, i got an output like you send, but still subject is empty.

    http://www.mydomain.com/members/admin/messages/compose/?r=acengiz&subject=Testing&_wpnonce=03298ddbab#sthash.9wLXZGyF.dpuf

    here is the image:
    Message subject field


    acengiz
    Participant

    @acengiz

    By the way, i create subfolders as below in my child theme directory and put compose.php in it:
    /wp-content/themes/kleo-child/buddypress/members/single/messages

    i tried to change label name “friend” to “friiiiend” and result was no change :/
    i think i am missing something, what you think?

    <label for="send-to-input"><?php _e("Send To (Username or Friiiend's Name)", 'buddypress' ); ?></label>


    shanebp
    Moderator

    @shanebp

    Ask Kleo how to add BP templates in a Kleo child theme.


    colabsadmin
    Participant

    @colabsadmin

    There’s no special way to do this in Kleo. You override it like you would with any other theme. The issue is that you have a space between compose and .php in the file name.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘subject in private message’ is closed to new replies.
Skip to toolbar