• renkcreative

    (@renkcreative)


    Hello Shamim,

    Your code is not working. Can you control it or update?

    function fep_new_user_message($user_id) {
    	global $wpdb;
    
    		$from = 1;  //change with your admin id
    		$title = 'SUBJECT';  //change message title
    		$content = 'MESSAGE';  //change message content
    		$date = current_time('mysql');
    		$table = $wpdb->prefix."fep_messages";
    
    		$wpdb->query($wpdb->prepare("INSERT INTO $table (from_user, to_user, message_title, message_contents, last_sender, date, last_date) VALUES ( %d, %d, %s, %s, %d, %s, %s )", $from, $user_id, $title, $content, $from, $date, $date));
    		}
    		add_action( 'user_register', 'fep_new_user_message', 10, 1 );

    https://www.ads-software.com/plugins/front-end-pm/

Viewing 1 replies (of 1 total)
  • Hi renkcreative.

    Thanks for the plugin Shamim Hasan.

    I′ve been trying the code and I think that the problem is in this line:
    $wpdb->query($wpdb->prepare("INSERT INTO $table (from_user, to_user, message_title, message_contents, last_sender, date, last_date) VALUES ( %d, %d, %s, %s, %d, %s, %s )", $from, $user_id, $title, $content, $from, $date, $date));

    Change it with:
    $wpdb->query($wpdb->prepare("INSERT INTO $table (from_user, to_user, message_title, message_contents, last_sender, send_date, last_date) VALUES ( %d, %d, %s, %s, %d, %s, %s )", $from, $user_id, $title, $content, $from, $date, $date));

    I′ve only modified the db table col name (date by send_date)

Viewing 1 replies (of 1 total)
  • The topic ‘Send a new message to new registered users’ is closed to new replies.