--- user_badges.module +++ user_badges.original @@ -142,6 +142,9 @@ case 'load': if ($user->uid > 0) { + if (variable_get('user_badges_profileonly', 0) && !(arg(0) == 'user' && is_numeric(arg(1)))) { + break; + } $user->badges = user_badges_get_badges($user->uid); } break; @@ -969,6 +972,13 @@ t('Note that if there is no badge associated to blocked users, no badges will appear.') .'
'. t('This option only acts on blocked users and has no repercussions on active user badges.'), ); + $form['profileonly'] = array( + '#type' => 'checkbox', + '#title' => t('Only load badges on user profile'), + '#default_value' => variable_get('user_badges_profileonly', 0), + '#description' => t('If checked, user badges will only be loaded when on the users profile page.') .'
'. + t('Note that any other location that needs the user badges loaded must call for it using the user_badges_get_badges() function.'), + ); $form[] = array( '#type' => 'submit', '#value' => t('Save Settings'), @@ -980,6 +990,7 @@ function user_badges_settings_form_submit($form_id, $form_values) { variable_set('user_badges_showone', $form_values['showone']); variable_set('user_badges_showblocked', $form_values['showblocked']); + variable_set('user_badges_profileonly', $form_values['profileonly']); $message = ($form_values['showone'] ? t('Only the most highest-level user badge will be shown.') : t('All user badges will be shown.')) .' '. ($form_values['showblocked'] ? t('Blocked users only will have blocked