Home › Forums › Front End PM PRO › Need to Update Message Title from Reply Message Meta
- This topic has 11 replies, 2 voices, and was last updated 6 years, 1 month ago by David.
- AuthorPosts
- October 28, 2019 at 7:36 pm #30531DavidParticipant
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.October 29, 2019 at 8:07 am #30568Shamim HasanKeymasterYes 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' ] );October 29, 2019 at 2:42 pm #30580DavidParticipantThanks 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.
October 29, 2019 at 8:08 pm #30587Shamim HasanKeymasteri have corrected above code. Please try again.
October 30, 2019 at 12:32 am #30592DavidParticipantThanks 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..
October 30, 2019 at 7:22 pm #30628Shamim HasanKeymasterfep_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.
November 1, 2019 at 8:24 pm #30696DavidParticipantHi 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.
November 1, 2019 at 8:26 pm #30699DavidParticipantSorry, please updated last:
“I get the error as mentioned before. I have checked the output of $message_parent and it is 495.”
November 1, 2019 at 11:42 pm #30705Shamim HasanKeymasterCan you please send me full code you are using? and which hook you are using?
November 1, 2019 at 11:46 pm #30707DavidParticipantadd_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);November 2, 2019 at 12:30 am #30710Shamim HasanKeymasterInstead of
fep_get_the_id()use$message_idNovember 2, 2019 at 12:46 am #30712DavidParticipantThanks very much Shamim. It is working now 🙂
I appreciate your help in this!
- AuthorPosts
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.