@qnkov
Is there actual problem with that query
Are you using the “Enable custom table for usermeta” at UM Settings -> Misc?
* SQL_CALC_FOUND_ROWS is deprecated as of MySQL 8.0.17
* https://core.trac.wordpress.org/ticket/47280
Thread Starter
qnkov
(@qnkov)
@missveronicatv
https://imgur.com/a/CxHd56v – i’ve disable cache for users after i posted. Should i unstick tables?
And i’m using those custom codes in my function.php, could any of them doing problems?
////////////////////////////////////////////////////////////////////////
// Ultimate Member Profile Display Name Integration ////////////////////
////////////////////////////////////////////////////////////////////////
add_filter('wpdiscuz_comment_author', 'wpdiscuz_um_author', 10, 2);
function wpdiscuz_um_author($author_name, $comment) {
if ($comment->user_id) {
$column = 'display_name'; // Other options: 'user_login', 'user_nicename', 'nickname', 'first_name', 'last_name'
if (class_exists('UM_API') || class_exists('UM')) {
um_fetch_user($comment->user_id); $author_name = um_user($column); um_reset_user();
} else {
$author_name = get_the_author_meta($column, $comment->user_id);
}
}
return $author_name;
}
////////////////////////////////////////////////////////////////////////
// Ultimate Member Profile URL Integration /////////////////////////////
////////////////////////////////////////////////////////////////////////
add_filter('wpdiscuz_profile_url', 'wpdiscuz_um_profile_url', 10, 2);
function wpdiscuz_um_profile_url($profile_url, $user) {
if ($user && (class_exists('UM_API') || class_exists('UM'))) {
um_fetch_user($user->ID); $profile_url = um_user_profile_url();
}
return $profile_url;
}
function um_custom_validate_bot_spam( $key, $array, $args ) {
if ( isset( $args[$key] ) && $args[$key] != 'ОТАКУ ФЕН' ) {
UM()->form()->add_error( $key, __( 'Напишете думите правилно и с главни букви.', 'ultimate-member' ) );
}
}
add_action( 'um_custom_field_validation_bot_spam', 'um_custom_validate_bot_spam', 30, 3 );
add_filter( 'auto_update_plugin', '__return_false' );
/* Disable oEmbeds author name & author url ~ Stops Showing in embeds */
add_filter( 'oembed_response_data', 'disable_embeds_filter_oembed_response_data_' );
function disable_embeds_filter_oembed_response_data_( $data ) {
unset($data['author_url']);
unset($data['author_name']);
return $data;
}
add_filter( "um_user_profile_tabs", "um_072522_add_comment_count", 1000 );
function um_072522_add_comment_count( $tabs ) {
if( isset( $tabs['comments'] ) && ! isset( $tabs['comments']['notifier'] ) ){
$args = array(
'user_id' => um_profile_id(), // Use user_id.
'count' => true // Return only the count.
);
$comments_count = get_comments( $args );
$tabs['comments']['notifier'] = $comments_count;
}
return $tabs;
-
This reply was modified 2 years, 2 months ago by
qnkov.
@qnkov
It’s only when the code for “Enable custom table for usermeta”
at UM Settings -> Misc is enabled the SQL_CALC_FOUND_ROWS is used.
Did you switch to the UM usermeta table because of bad performance
with the WP usermeta table?
How many registered Users do you have?
Unclick the “Disable Cache User Profile” to enable UM User caching.
You can clear the Cache at UM Dashboard if there are many Users cached.
-
This reply was modified 2 years, 2 months ago by
missveronica.
Thread Starter
qnkov
(@qnkov)
3-4k users. I don’t remember when i switched to usermeta table. I think i had problems back then and i was told to enable it. Should i disable it now or? By the way, i’ve removed all the codes i gave u from my function.php and site works fine now. Maybe some of them was making the bad quaries?
@qnkov
Code snippet with $comments_count = get_comments( $args );
from this thread with memory issues:
https://wordpress.org/support/topic/um-documentation-2/
Thread Starter
qnkov
(@qnkov)
@missveronicatv
What is the full fixed code, which will work without problems and heavy cpu?
@qnkov
Using the um_profile_tabs hook instead of the um_user_profile_tabs hook may help.
Hi @qnkov
This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.
Please feel free to re-open this thread if any other questions come up and we’d be happy to help. 🙂
Regards