Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Howdy All,
Was wondering if there was a way to remove the "Twitter Accounts" DT from a user profile page.
It doesn't show up on the manage display page for user accounts and I would rather not hide it with CSS.
Any suggestions would be great.
Thanks - Jp
Comments
Comment #1
oliverwestbury CreditAttribution: oliverwestbury commentedYou can hide two codes via twitter module folder :- twitter.module
line 112:
/**
* Default callback for theme('twitter_user_accounts');
*
* Renders a list of Twitter accounts for the user profile page.
*/
// function theme_twitter_user_accounts($variables) {
// module_load_include('inc', 'twitter');
// $accounts = $variables['accounts'];
// $items = array();
// foreach ($accounts as $twitter_account) {
// $tweets = twitter_tweets($twitter_account->screen_name);
// // If we have tweets for this Twitter account, link to the View. If not, link to Twitter.
// if (count($tweets)) {
// $items[] = l('@' . $twitter_account->screen_name, 'tweets/' . $twitter_account->screen_name);
// }
// else {
// $items[] = _twitter_user_profile($twitter_account->screen_name);
// }
// }
// return theme('item_list', array('items' => $items));
// }
AND
line 350:
function twitter_user_view_alter(&$build) {
$user = $build['#account'];
// if (!empty($user->twitter_accounts)) {
// $build['twitter'] = array(
// '#type' => 'user_profile_item',
// '#title' => t('Twitter accounts'),
// '#markup' => theme('twitter_user_accounts', array('accounts' => $user->twitter_accounts)),
// '#weight' => 10,
// );
// }
}
Comment #2
ribakker CreditAttribution: ribakker commentedI think the solution by oliverwestbury is not recommended. That'd be a core hack to the original Twitter module code. It's better to implement hook_user_view_alter yourself and remove the Twitter item from there. Code example:
You might also want to give your custom module a higher weight, otherwise the hook above will be fired too early. Code example:
Comment #3
mkolar CreditAttribution: mkolar commentedSolusion for version 7.x-5.8
Comment #4
doitDave CreditAttribution: doitDave commentedSubscribing for a better solution. Although I thank for the suggestions, I would prefer to have this information manageable in the "manage display" page, for of course I may want to display a user's twitter account, only I want to do it my way :)
Sorry I'm not so deep into Field API right now, otherwise I would have suggested a patch right away. Also, thanks for the all-in-all great module!
Comment #5
DamienMcKennaComment #6
madhaze CreditAttribution: madhaze commented#3 worked for me but i would much rather be able to control it in manage display. Also This really needs any kind of wrapper with a class so it can be themed.
Comment #7
hawkeye.twolfI agree that this belongs the module's configuration page. For the time being, I just did this, which to me is the best because I don't like messing with module weights:
Comment #8
DamienMcKennaLets focus this on making the information manageable via hook_field_extra_fields.