This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 3 replies, has 0 voices.
Last updated by ericH-23 1 day, 18 hours ago.
Assisted by: Andreas W..
Author | Posts |
---|---|
December 22, 2024 at 8:57 pm #16538895 | |
ericH-23 |
Background of the issue: Symptoms: Questions: |
December 24, 2024 at 12:33 pm #16543669 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Hello, Please take a backup of your site and then test the following workaround instead: function resume_manager_count_user_resumes( $user_id = 0 ) { global $wpdb; if ( ! $user_id ) { $user_id = get_current_user_id(); } // Check if WPML is active if ( defined( 'ICL_LANGUAGE_CODE' ) ) { // Get the default language code $default_language = apply_filters( 'wpml_default_language', null ); // Query to count resumes across all languages (including translations) return $wpdb->get_var( $wpdb->prepare( " SELECT COUNT(DISTINCT p.ID) FROM {$wpdb->posts} p LEFT JOIN {$wpdb->prefix}icl_translations t ON p.ID = t.element_id WHERE p.post_author = %d AND p.post_type = 'resume' AND p.post_status IN ( 'publish', 'pending', 'expired', 'hidden' ) AND ( t.language_code = %s OR t.source_language_code IS NULL ) ", $user_id, $default_language ) ); } // Default query if WPML is not active (only counts resumes in the default language) return $wpdb->get_var( $wpdb->prepare( " SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_author = %d AND post_type = 'resume' AND post_status IN ( 'publish', 'pending', 'expired', 'hidden' ); ", $user_id ) ); } // Check if the resume limit is reached and remove the "Add Resume" button function resume_manager_add_resume_button( $user_id = 0 ) { $limit = 5; // Set the resume limit (this could be dynamic or configurable) $resume_count = resume_manager_count_user_resumes( $user_id ); if ( $resume_count >= $limit ) { // Add custom code to hide or disable the "Add Resume" button echo '<style>#add_resume_button { display: none; }</style>'; } } Take note, that this workaround sets the limit to 5 inside the function resume_manager_add_resume_button() at: $limit = 5; If this will not solve the issue, I will be glad to provide a WPML test site, on which we can recreate the issue and work on a solution. Best regards |
December 31, 2024 at 6:11 pm #16556414 | |
ericH-23 |
Hi, |
December 31, 2024 at 7:28 pm #16556431 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Hi Eric, The ticket will remain open for two weeks. I will be awaiting your next reply as soon as possible. Best regards |
January 1, 2025 at 4:34 pm #16557303 | |
ericH-23 |
Hi, |