How to automatically send messages to newly registered users?


Home Forums Front End PM PRO How to automatically send messages to newly registered users?

This topic is: Not Resolved

Tagged: 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #10308
    laowei
    Participant

    User registration will receive a message, hope to answer!

    #10331
    Shamim Hasan
    Keymaster
    #10338
    laowei
    Participant

    Thank you for your response!

    f a user’s article from pending review has been released, how can we send a message?

    #10341
    laowei
    Participant
    function 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

    #10344
    laowei
    Participant

    One more problem: the plug-in shows all the time is wrong.
    A difference of 8 hours from my local time.
    I am in China.

    #10347
    Shamim Hasan
    Keymaster

    As 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 );
    
    #10350
    laowei
    Participant

    One more problem: the plug-in shows all the time is wrong.
    A difference of 8 hours from my local time. I am in China.

    #10353
    Shamim Hasan
    Keymaster

    Please go to Dashboard > Settings > General and check your timezone setup.

    #10356
    laowei
    Participant

    My 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

    #10359
    Shamim Hasan
    Keymaster

    I 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.

    #10439
    laowei
    Participant

    Line 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?

    #10444
    Shamim Hasan
    Keymaster

    Please 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.

    #10570
    laowei
    Participant

    Hello, according to your way is normal.

    #10578
    Shamim Hasan
    Keymaster

    Is it working correctly in your setup after this change?

Viewing 14 posts - 1 through 14 (of 14 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.