Need to Update Message Title from Reply Message Meta


Home Forums Front End PM PRO Need to Update Message Title from Reply Message Meta

This topic is: Resolved
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #30531
    David
    Participant

    Hi Shamim,
    Sorry for yet another question!
    Is it possible to update the message title for a threaded message from message meta taken from a reply message?
    I see msg_title is not message meta so using the fep_update_meta does not work.
    Any help is appreciated.

    #30568
    Shamim Hasan
    Keymaster

    Yes possible.
    First get message id which title you want to change (parent message). Then use following code

    $message = fep_get_message( 1 ); //1 is message id which title you want to update
    $message->update( [ 'mgs_title' => 'UPDATED TITLE HERE' ] );
    
    #30580
    David
    Participant

    Thanks but that is giving an error:

    Parse error: syntax error, unexpected ‘=>’ (T_DOUBLE_ARROW), expecting ‘,’ or ‘)’

    I tried

    $message = fep_get_message( 1 ); //1 is message id which title you want to update
    $message->update( ‘mgs_title’, ‘UPDATED TITLE HERE’ );

    but that did not work either.

    #30587
    Shamim Hasan
    Keymaster

    i have corrected above code. Please try again.

    #30592
    David
    Participant

    Thanks very much but I am having a couple of issues…

    First the message does not send:
    I see “Refresh this page and try again.” When I refresh the page it works.
    There is an error:
    Failed to load resource: the server responded with a status of 500 () for wp-admin/admin-ajax.php.

    Second, I need the fep_get_message( 1 ) to be dynamic as the parent of the current message.

    Thanks for your help..

    #30628
    Shamim Hasan
    Keymaster

    fep_get_message( 1 ) to be dynamic you can use dynamic value instead of 1.

    For other 2 issues, i need access in your website so that i can see.

    #30696
    David
    Participant

    Hi again,

    Ok, if I do this:

    $message_reply = fep_get_message( 495 );
    $message_reply->update( [ ‘mgs_title’ => ‘UPDATED TITLE HERE’ ] );

    it works ok.

    However, when I make it dynamic:

    $message_parent = fep_get_parent_id(fep_get_the_id());
    $message_reply = fep_get_message( $message_parent );
    $message_reply->update( [ ‘mgs_title’ => ‘UPDATED TITLE HERE’ ] );

    I get the error as mentioned before. I have checked the output of $message_reply and it is 495.

    Even after a refresh it does not update.

    Let me know what you need in order to have a look at the site.

    Thanks for your help.

    #30699
    David
    Participant

    Sorry, please updated last:

    “I get the error as mentioned before. I have checked the output of $message_parent and it is 495.”

    #30705
    Shamim Hasan
    Keymaster

    Can you please send me full code you are using? and which hook you are using?

    #30707
    David
    Participant

    add_action( ‘fep_action_message_after_send’, function( $message_id, $message, $new_message ){
    $message_parent = fep_get_parent_id(fep_get_the_id());
    $message_reply = fep_get_message( $message_parent );
    $message_reply->update( [ ‘mgs_title’ => ‘UPDATED TITLE HERE’ ] );
    }, 10, 3);

    #30710
    Shamim Hasan
    Keymaster

    Instead of fep_get_the_id() use $message_id

    #30712
    David
    Participant

    Thanks very much Shamim. It is working now 🙂

    I appreciate your help in this!

Viewing 12 posts - 1 through 12 (of 12 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.