Skip to:
Content
Pages
Categories
Search
Top
Bottom

messages_new_messages not working with HTML content


  • rgipp1
    Participant

    @rgipp1

    I’m trying to send a message to a user with HTML button that has a link.

    I’m making content (message body) from reading a file with html code that is working standalone as far as displaying my button.

    My php code and the content from the file are shown below.

    It seems to get hung up on everything in the style section not recognizing it.

    $Recipient = $the_user->ID;
    $Sender = 1;
    $subject = ‘Welcome to myvirtualpersonaltrainer.com’;
    //Content is in file messageBodyForClientLogin.txt
    $filename=”messageBodyForClientLogin.txt”;
    $file=fopen($filename,”r”);
    $multilinecomments = fread($file,filesize($filename));
    $content = $multilinecomments;
    $args = array(‘sender_id’ => $Sender, ‘subject’ => $subject, ‘content’ => $content , ‘recipients’ => $Recipient );
    messages_new_message( $args ) ;

    file messageBodyForClientLogin.txt
    <html>
    <style>
    .button {
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    }
    .button1 {border-radius: 2px;}
    .button2 {border-radius: 4px;}
    .button3 {border-radius: 8px;}
    .button4 {border-radius: 12px;}
    .button5 {border-radius: 50%;}
    </style>
    </body>
    <p>Welcome to your virtual personal trainer website!!! <br>
    Youve taken the first step in joining a virtual personal training site as a trainee. </p>
    Request Training Advice</button>
    <body>

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

  • rgipp1
    Participant

    @rgipp1

    Got this working.

    Had to make modifications in the core BP.


    Jing
    Participant

    @gujingc

    Hi, we are running into issue that might related to what you solved.

    When using the default function of buddypress to message another user: messages_new_message()

    Instead of getting the thread ID, we are getting a False.

    How can we get the thread ID? Any suggestion is greatly appreciated.

    Jing

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar