Home › Forums › Front End PM PRO › How to automatically send messages to newly registered users?
Tagged: user
- This topic has 13 replies, 2 voices, and was last updated 6 years, 10 months ago by Shamim Hasan.
-
AuthorPosts
-
January 28, 2018 at 10:29 am #10308laoweiParticipant
User registration will receive a message, hope to answer!
January 28, 2018 at 11:45 am #10331Shamim HasanKeymasterJanuary 28, 2018 at 6:35 pm #10338laoweiParticipantThank you for your response!
f a user’s article from pending review has been released, how can we send a message?
January 28, 2018 at 7:14 pm #10341laoweiParticipantfunction fep_cus_user_post_send_messaage($post_id){ global $post_id; $post = get_post($post_id); $author = get_userdata($post->post_author); $author_id = $author->ID; $post_title = $post->post_title; $post_link = get_permalink($post); if ($post->post_type !== 'post') return; if ( ! function_exists( 'fep_send_message' ) ) return; // Prepare message data $message = array( 'message_title' => 'title', //change with message title 'message_content' => 'xxx', //change with message content 'message_to_id' => $user_id ); $override = array( 'post_author' => 1, //change with message sender id ); // Send message fep_send_message( $message, $override ); } add_action( 'pending_to_trash', 'fep_cus_user_post_send_messaage', 10, 1 );
This does not seem to work
January 28, 2018 at 7:38 pm #10344laoweiParticipantOne more problem: the plug-in shows all the time is wrong.
A difference of 8 hours from my local time.
I am in China.January 28, 2018 at 10:06 pm #10347Shamim HasanKeymasterAs you want to send message to users when post is published, you can use following code
function fep_cus_user_post_send_messaage($post){ $author = get_userdata($post->post_author); $author_id = $author->ID; $post_title = $post->post_title; $post_link = get_permalink($post); if ($post->post_type !== 'post') return; if ( ! function_exists( 'fep_send_message' ) ) return; // Prepare message data $message = array( 'message_title' => 'title', //change with message title 'message_content' => 'xxx', //change with message content 'message_to_id' => $author_id ); $override = array( 'post_author' => 1, //change with message sender id ); // Send message fep_send_message( $message, $override ); } add_action( 'pending_to_publish', 'fep_cus_user_post_send_messaage', 10, 1 );
January 28, 2018 at 10:07 pm #10350laoweiParticipantOne more problem: the plug-in shows all the time is wrong.
A difference of 8 hours from my local time. I am in China.January 28, 2018 at 10:15 pm #10353Shamim HasanKeymasterPlease go to Dashboard > Settings > General and check your timezone setup.
January 28, 2018 at 10:19 pm #10356laoweiParticipantMy time zone is set shanghai, and my other content shows normal.
Only Front End PM PRO time is eight hours ago.
very strange
Finally, thank you for your enthusiastic reply
January 28, 2018 at 10:49 pm #10359Shamim HasanKeymasterI tried in my test installation with shanghai timezone setup and it shows correctly.
Please again check your timezone setup, if require change to UTC and save, again shanghai and save.
Then send a message, and check front end as well as back-end to check time of that message.
Go to Dashboard > Front End PM PRO > All Messages to check that message time in back-end.
If both places show wrong time, Then deactivate all plugins and change theme to default theme and send message and check time.Let me know.
January 30, 2018 at 4:26 pm #10439laoweiParticipantLine 726 in the plug-in file functions.php
$time = strtotime( $post->post_date_gmt );
change into
$time = strtotime( $m_time );
Will normally show the local time. Otherwise, no matter the time zone to change the country, will be subject to the United States time!So, when users in other countries use 8 hours more, it is a flaw?
January 30, 2018 at 6:56 pm #10444Shamim HasanKeymasterPlease change
$time = strtotime( $post->post_date_gmt );
to$time = get_post_time( 'G', true, $post, false );
and see if it working correctly.
Let me know.February 2, 2018 at 7:54 pm #10570laoweiParticipantHello, according to your way is normal.
February 2, 2018 at 11:15 pm #10578Shamim HasanKeymasterIs it working correctly in your setup after this change?
-
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.