Home › Forums › Front End PM PRO › Help with Version 10.1.1 Database Changes › Reply To: Help with Version 10.1.1 Database Changes
September 16, 2018 at 9:56 pm
#17472
Shamim Hasan
Keymaster
I am really sorry for issue arise. In this major version plugin performance is highly improved. So some of the function could not be backward compatible.
To see full changes of this plugin please see https://github.com/shamim2883/front-end-pm
add_action( 'gfpdf_post_save_pdf_5', function( $pdf_path, $filename, $settings, $entry, $form ) {
global $wpdb;
$user = wp_get_current_user();
$user_ID = $user->ID;
$message = array(
'message_title' => $form['title'],
'message_content' => "Message Goes Here",
'message_to_id' => $user_ID,
);
$override = array(
'post_author' => 1,
);
//Turn off email send
remove_action( 'fep_status_to_publish', array( Fep_Emails::init(), 'send_email'), 99, 2 );
//Post message in Frontend PM
$message_id = fep_send_message( $message, $override );
//Prepare Attachment
$upload_dir = wp_upload_dir();
$upload_dir = $upload_dir['basedir'];
$subdir = '';
if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
$time = current_time( 'mysql' );
$y = substr( $time, 0, 4 );
$m = substr( $time, 5, 2 );
$subdir = "/$y/$m";
}
$upsub = '/front-end-pm' . $subdir;
$copy_to_dir = $upload_dir . $upsub . '/';
if( ! is_dir( $copy_to_dir ) ) {
wp_mkdir_p( $copy_to_dir );
}
$newfilename = wp_unique_filename( $upload_dir, $filename );
$pathtofile = $copy_to_dir . $newfilename;
copy( $pdf_path, $pathtofile );
$attachment[] = array(
'att_file' => $pathtofile,
'att_mime' => 'application/pdf',
);
//Add attachment to Frontend PM post
FEP_Attachments::init()->insert( $message_id, $attachment );
//Update user information
update_user_meta( $user_ID, 'payment', '' );
update_user_meta( $user_ID, 'renew', date("Y-m-d", time()));
}, 10, 5 );
I have corrected above code (untested), Please check.
For query messages new class FEP_Message_Query
added. Please use this class. You can go to class-fep-messages.php and see user_messages method to see how it is used. You can also see FEP_Message_Query class __construct to see what args you can pass.
Let me know if any more assistance needed.