MySQL Errors with Formidable Forms
-
Can’t use this plugin when Formidable (Pro) is enabled:
[Not unique table/alias: 'ham_postmeta']<br /><code>SELECT SQL_CALC_FOUND_ROWS DISTINCT ham_posts.ID FROM ham_posts LEFT JOIN ham_postmeta ON (ham_posts.ID = ham_postmeta.post_id AND ham_postmeta.meta_key = '_frm_temporary' ) LEFT JOIN ham_postmeta AS mt1 ON (ham_posts.ID = mt1.post_id AND mt1.meta_key = '_frm_file' ) LEFT JOIN ham_postmeta ON ham_posts.ID = ham_postmeta.post_id LEFT JOIN ham_postmeta AS sq1 ON ( ham_posts.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' ) WHERE 1=1 AND ( ( ham_postmeta.post_id IS NULL AND mt1.post_id IS NULL ) ) AND ham_posts.post_type = 'attachment' AND ((ham_posts.post_status = 'inherit' OR ham_posts.post_status = 'private'))AND ID IN (-1) GROUP BY ham_posts.ID ORDER BY ham_posts.post_date DESC LIMIT 0, 200
i browsed code by _frm_temporary and this is what i found:
/** * Set _frm_temporary and _frm_file metas * to use for media library filtering */ private static function add_meta_to_media( $media_ids, $type = 'temporary' ) { foreach ( (array) $media_ids as $media_id ) { if ( is_numeric( $media_id ) ) { update_post_meta( $media_id, '_frm_' . $type, 1 ); } } } /** * When an entry is saved, remove the temp flag */ private static function remove_meta_from_media( $media_ids ) { foreach ( (array) $media_ids as $media_id ) { if ( is_numeric( $media_id ) ) { delete_post_meta( $media_id, '_frm_temporary' ); } } }
public static function filter_media_library( $query ) { if ( 'attachment' == $query->get( 'post_type' ) ) { $meta_query = $query->get( 'meta_query' ); self::query_to_exclude_files( $meta_query ); $query->set( 'meta_query', $meta_query ); } } private static function query_to_exclude_files( &$meta_query ) { if ( current_user_can( 'frm_edit_entries' ) ) { $show = FrmAppHelper::get_param( 'frm-attachment-filter', '', 'get', 'absint' ); } else { $show = false; } if ( ! is_array( $meta_query ) ) { $meta_query = array(); } else { $continue = self::nest_attachment_query( $meta_query ); if ( ! $continue ) { return; } } $meta_query[] = array( 'relation' => 'AND', array( 'key' => '_frm_temporary', 'compare' => 'NOT EXISTS', ), array( 'key' => '_frm_file', 'compare' => $show ? 'EXISTS' : 'NOT EXISTS', ), ); }
add_action( 'pre_get_posts', 'FrmProFileField::filter_media_library', 99 );
hope this helps to fix the error!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘MySQL Errors with Formidable Forms’ is closed to new replies.