David
Forum Replies Created
-
AuthorPosts
-
DavidParticipant
Hi Shamim,
I think it would be a great addition to the plugin if we could add the user ID info to the notification emails so that they could be passed as a URL parameter for example to unsubscribe using fep_update_user_option( ‘allow_emails’, 0 ‘$userID’ ) without the need to be logged in.
Is there any chance this could be incorporated in a future version?
DavidParticipantOh man, I have fallen to that one before and I didn’t even spot it…
Ok, now it works. I really appreciate your help!!
Thank you!
DavidParticipantHere is the full code:
$busman = fep_get_meta( fep_get_parent_id(fep_get_the_id()), ‘cus_fep_business’, true );
$args = array(
‘mgs_type’ => ‘message’,
‘mgs_status’ => ‘publish’,
‘mgs_parent’ => 0,
‘per_page’ => 10,
‘fields’ => [ ‘mgs_id’, ‘mgs_title’ ],
‘participant_query’ =>
[
[
‘mgs_participant’ => $busman,
],
],
‘meta_query’ =>
[
[
‘key’ => ‘cus_fep_update’,
‘value’ => ‘driverupdate’,
],
],
);$mgs = fep_get_messages( $args );
if ( $mgs ) {
foreach ( $mgs as $mg ) {
fep_update_meta( $mg->mgs_id, ‘test_meta’, ‘test’ );
}
}
wp_reset_query();If I add this code into the page and load it as normal, all of the messages update with the new meta. However, if I add this code into add_action( ‘fep_action_message_after_send’, function( $message_id, $message, $new_message ){ it does not work. That action is working ok for all the other meta that is being added and updated in it.
Debugging is something that is beyond my skill set at the moment but I will look into it. Any other ideas you have would be appreciated.
DavidParticipantIt is using fep_action_message_after_send
DavidParticipantThanks, I have sent you a message through the contact form.
DavidParticipantThanks for the quick reply.
Not quite…
Here is the flow:
1. User a and user b communicate with messages.
2. A booking is completed. The booking confirmation contains the link to the parent message which now has fep meta ‘booking_confirmed’.
3. User a and user b can delete the message thread from the message box.
4. After message deletion, for either user, the message can be accessed from the booking confirmation. They have permission to view the message and can send further messages in the same thread.
Essentially, when a message is deleted by either user with meta ‘booking_confirmed’ it only means that they cannot see the message in the message box. Everything else is the same. It is more like “hide” message.
DavidParticipantYes, it works perfectly. Many thanks!
DavidParticipantThanks!!
DavidParticipantsorry, yes, user with administrator role. There is only 1. I can also do it by user ID number which is 1 if that helps.
November 2, 2019 at 12:46 am in reply to: Need to Update Message Title from Reply Message Meta #30712DavidParticipantThanks very much Shamim. It is working now 🙂
I appreciate your help in this!
November 1, 2019 at 11:46 pm in reply to: Need to Update Message Title from Reply Message Meta #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 1, 2019 at 8:26 pm in reply to: Need to Update Message Title from Reply Message Meta #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 8:24 pm in reply to: Need to Update Message Title from Reply Message Meta #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.
October 30, 2019 at 12:32 am in reply to: Need to Update Message Title from Reply Message Meta #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 29, 2019 at 2:42 pm in reply to: Need to Update Message Title from Reply Message Meta #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.
-
AuthorPosts