//$profile это нода профиля, заменить на свою if(!empty($profile->taxonomy)){ foreach($profile->taxonomyas$tid =>$term){ if($term->vid == 3){// 3 это vid словаря таксономии с городами $location_tid = $term->tid; break; } } }
не работает конструкция... ничего не выводит.
вобщем как и другие сск поля кроме текстовых.
работает всё, только тупить не надо.
почему всегда надо вытягивать информацию из вас чторбы помочь? у нас дохера времени всем помогать?
1) вывести надо в шаблон? какой?
2) код все этой фигни встудию
3) поля не выводятся, потому что надо уметь к ним обращаться. а для этого надо хотябы уметь вывести массив значений, ну или devel на худой конец поставить!
1. установил модуль content profile
2. создал словарь со странами и городами
3. в типе материала profile создал сск поле field_c (Категория материала)
4. забил в типе материала profile страну город. сохраняюсь. профиль такой-то создан.
5. пытаюсь это все вывести в user-profile.tpl.php
[new_role] =>0 [new_role_add] =>12 [new_role_add_qty] => [new_role_add_granularity] => day [language_value] => ru [revision_id] =>1 [dgb_status] =>1 [dgb_intro] => Хорошая крыша летает сама, то в самый низ то в самые верха... [user_title] => Мы будем жить всегда... [dgb_visited] =>1305103802 [current_file] => [activity_ignore] =>Array ( [5] =>1 )
[new_role] =>0 [new_role_add] =>12 [new_role_add_qty] => [new_role_add_granularity] => day [language_value] => ru [revision_id] =>1 [dgb_status] =>1 [dgb_intro] => Хорошая крыша летает сама, то в самый низ то в самые верха... [user_title] => Мы будем жить всегда... [dgb_visited] =>1305103802 [current_file] => [activity_ignore] =>Array ( [5] =>1 )
[#type] => user_profile_category [#children] =>
Хобби
Сайтостроительство и Интернет
Любимая музыка
Агата Кристи, ПТВП, The Matrixx, Алиса, Мумий Тролль
Любимые фильмы
Криминальное чтиво, Пираты карибского моря
[#description] => [#title] => Время участия [#value] => 1 год 4 недели [#type] => user_profile_item [#printed] => 1 )
[#attributes] => Array ( [class] => user-member )
[#weight] => 5 [#title] => История [#type] => user_profile_category [#children] =>
Гостевая
Посмотреть последние записи гостевой
Время участия 1 год 4 недели
Комментарии
вывести как на друите? или саму форму где-то?
Ну как на друите. Форму пока не требуется выводить.
if (!empty($profile->taxonomy)) {
foreach ($profile->taxonomy as $tid => $term) {
if ($term->vid == 3) { // 3 это vid словаря таксономии с городами
$location_tid = $term->tid;
break;
}
}
}
if ($location_tid) {
$parents = taxonomy_get_parents_all($location_tid);
foreach (array_reverse($parents) as $parent) {
$location[] = l($parent->name, taxonomy_term_path($parent));
}
if (!empty($location)) print implode(', ', $location);
}
что такое нода профиля?
название ноды контентпрофайл???
что не работает.
foreach ($profile->taxonomy as $tid => $term) {
if ($term->vid == 47) { // 47 это vid словаря таксономии с городами
$location_tid = $term->tid;
break;
}
}
}
if ($location_tid) {
$parents = taxonomy_get_parents_all($location_tid);
foreach (array_reverse($parents) as $parent) {
$location[] = l($parent->name, taxonomy_term_path($parent));
}
if (!empty($location)) print implode(', ', $location);
}
жесть))) нода профиля - это нода типа "профиль", те объект.
ну я понял она по дефолту такая profile
не работает конструкция... ничего не выводит.
вобщем как и другие сск поля кроме текстовых.
работает всё, только тупить не надо.
почему всегда надо вытягивать информацию из вас чторбы помочь? у нас дохера времени всем помогать?
1) вывести надо в шаблон? какой?
2) код все этой фигни встудию
3) поля не выводятся, потому что надо уметь к ним обращаться. а для этого надо хотябы уметь вывести массив значений, ну или devel на худой конец поставить!
penexe, и так
1. установил модуль content profile
2. создал словарь со странами и городами
3. в типе материала profile создал сск поле field_c (Категория материала)
4. забил в типе материала profile страну город. сохраняюсь. профиль такой-то создан.
5. пытаюсь это все вывести в user-profile.tpl.php
$content_profile = content_profile_load('profile', $account->uid);
if ($location_tid = $content_profile->field_c[0]['value']) {
$parents = taxonomy_get_parents_all($location_tid);
foreach (array_reverse($parents) as $parent) {
$location[] = l($parent->name, taxonomy_term_path($parent));
}
if (!empty($location)) {
print implode(', ', $location);
}
}
?>
работает только если ('profile', $account->uid);
поменять на ('profile', $uid);
(вычитал это на апи.друпал.ру)
чушь какая, нет в профиле такой переменной
ну работает только так. и текстовые тоже... выводятся сск поля без $account->uid а только ($uid)
<?php drupal_set_message('<pre>'. print_r($account, 1) .'</pre>');?>
что выведет, скопируй сюда
(
[uid] => 0
[name] =>
[pass] =>
[mail] =>
[mode] => 0
[sort] => 0
[threshold] => 0
[theme] =>
[signature] =>
[signature_format] => 0
[created] => 0
[access] => 0
[login] => 127999991
[status] => 0
[timezone] => 14400
[language] =>
[picture] =>
[init] =>
[data] =>
[timezone_name] => Europe/Moscow
[roles] => Array
(
[1] => anonymous user
)
[form_build_id] =>
[userreference] => Array
(
)
[user_activity_index] =>
)
хех, как интересно сайт еще работает...
что -то уже отваливается... см. http://www.drupal.ru/node/62082
сложно вспомнить. пытаюсь по отрубать ненужные модули. Снипеты только переделал вывод юзеров - кто в онлайн.
---
в то же время косяки в вотинг апи случились.
ксти если вернуть стандартную страницу пользователя... то к Истории там верная цифра нахождения юзера на сайте...
Ой надо было в начало страницы вставлять вот вывод
(
[uid] => 5
[name] => iNFerNo
[pass] => ---
[mail] => ---[user=mail]mail[/user].ru
[mode] => 0
[sort] => 0
[threshold] => 0
[theme] =>
[signature] => Ручки, ручки, ручки...
[signature_format] => 2
[created] => 1270808491
[access] => 1305189312
[login] => 1305176525
[status] => 1
[timezone] => 14400
[language] => ru
[picture] => sites/default/files/pictures/picture-5.jpg
[init] => ---[user=mail]mail[/user].ru
[data] => Array
(
[current_date] => 1291373274
[current_id] => 2
[display] => 0
[birthdays_starsign] => pisces
[contact] => 1
[picture_delete] => 0
[picture_upload] =>
[guestbook_status] => 0
[guestbook_send_email] => 0
[guestbook_intro] =>
[block] => Array
(
[masquerade] => Array
(
[0] => 1
)
[user] => Array
(
[2] => 0
)
[shoutbox] => Array
(
[0] => 0
)
)
[guestbook_visited] => 1299065905
[select_avatar] =>
[usercomment_approve_article] => 1
[usercomment_approve_audio] => 1
[usercomment_approve_audioaudio] => 1
[usercomment_approve_book] => 1
[usercomment_approve_catalog] => 1
[usercomment_approve_concert] => 1
[usercomment_approve_disc] => 1
[usercomment_approve_gallery] => 1
[usercomment_approve_history] => 1
[usercomment_approve_imagewall_structure] => 1
[usercomment_approve_links] => 1
[usercomment_approve_news] => 1
[usercomment_approve_page] => 1
[usercomment_approve_personal_gallery] => 1
[usercomment_approve_photo] => 1
[usercomment_approve_photo_for_personal_gallery] => 1
[usercomment_approve_poetry] => 1
[usercomment_approve_profile] => 1
[usercomment_approve_quote] => 1
[usercomment_approve_song] => 1
[usercomment_approve_story] => 1
[usercomment_approve_tvscrin] => 1
[usercomment_approve_update] => 1
[usercomment_approve_video] => 1
[usercomment_approve_videovideo] => 1
[usercomment_get_notifications] => 1
[usercomment_approve_reports] => 1
[usercomment_approve_screenshot] => 1
[usercomment_approve_scrap] => 1
[usercomment_approve_verbatim] => 1
[usercomment_approve_questions_answered] => 1
[user_relationship_mailer_send_mail] => 1
[user_relationships_ui_auto_approve] => Array
(
[1] => 0
)
[mailru] => Array
(
[link] =>
[muid] =>
[pic_small] =>
[pic_big] =>
[pic] =>
[nick] =>
[login] =>
[email] =>
[sync_avatar] =>
)
[new_role] => 0
[new_role_add] => 12
[new_role_add_qty] =>
[new_role_add_granularity] => day
[language_value] => ru
[revision_id] => 1
[dgb_status] => 1
[dgb_intro] => Хорошая крыша летает сама, то в самый низ то в самые верха...
[user_title] => Мы будем жить всегда...
[dgb_visited] => 1305103802
[current_file] =>
[activity_ignore] => Array
(
[5] => 1
)
[page_title] =>
[nodeaccess_password] =>
[viewers_user_visibility] => 1
)
[timezone_name] => Europe/Moscow
[current_date] => 1291373274
[current_id] => 2
[display] => 0
[birthdays_starsign] => pisces
[contact] => 1
[picture_delete] => 0
[picture_upload] =>
[guestbook_status] => 0
[guestbook_send_email] => 0
[guestbook_intro] =>
[block] => Array
(
[masquerade] => Array
(
[0] => 1
)
[user] => Array
(
[2] => 0
)
[shoutbox] => Array
(
[0] => 0
)
)
[form_build_id] =>
[guestbook_visited] => 1299065905
[select_avatar] =>
[usercomment_approve_article] => 1
[usercomment_approve_audio] => 1
[usercomment_approve_audioaudio] => 1
[usercomment_approve_book] => 1
[usercomment_approve_catalog] => 1
[usercomment_approve_concert] => 1
[usercomment_approve_disc] => 1
[usercomment_approve_gallery] => 1
[usercomment_approve_history] => 1
[usercomment_approve_imagewall_structure] => 1
[usercomment_approve_links] => 1
[usercomment_approve_news] => 1
[usercomment_approve_page] => 1
[usercomment_approve_personal_gallery] => 1
[usercomment_approve_photo] => 1
[usercomment_approve_photo_for_personal_gallery] => 1
[usercomment_approve_poetry] => 1
[usercomment_approve_profile] => 1
[usercomment_approve_quote] => 1
[usercomment_approve_song] => 1
[usercomment_approve_story] => 1
[usercomment_approve_tvscrin] => 1
[usercomment_approve_update] => 1
[usercomment_approve_video] => 1
[usercomment_approve_videovideo] => 1
[usercomment_get_notifications] => 1
[usercomment_approve_reports] => 1
[usercomment_approve_screenshot] => 1
[usercomment_approve_scrap] => 1
[usercomment_approve_verbatim] => 1
[usercomment_approve_questions_answered] => 1
[user_relationship_mailer_send_mail] => 1
[user_relationships_ui_auto_approve] => Array
(
[1] => 0
)
[mailru] => Array
(
[link] =>
[muid] =>
[pic_small] =>
[pic_big] =>
[pic] =>
[nick] =>
[login] =>
[email] =>
[sync_avatar] =>
)
[new_role] => 0
[new_role_add] => 12
[new_role_add_qty] =>
[new_role_add_granularity] => day
[language_value] => ru
[revision_id] => 1
[dgb_status] => 1
[dgb_intro] => Хорошая крыша летает сама, то в самый низ то в самые верха...
[user_title] => Мы будем жить всегда...
[dgb_visited] => 1305103802
[current_file] =>
[activity_ignore] => Array
(
[5] => 1
)
[page_title] =>
[nodeaccess_password] =>
[viewers_user_visibility] => 1
[roles] => Array
(
[2] => authenticated user
[4] => модератор
)
[profile_realname] => Олег
[profile_sex] => мужской
[profile_web] => -
[profile_vkontakte] => -
[profile_icq] => 201962780
[profile_myself] => Яйца, табак, перегар и щетина...
[profile_city] => Москва
[profile_hobby] => Сайтостроительство и Интернет
[profile_music] => Агата Кристи, ПТВП, The Matrixx, Алиса, Мумий Тролль
[profile_movie] => Криминальное чтиво, Пираты карибского моря
[profile_birtday] => Array
(
[month] => 3
[day] => 20
[year] => ---
)
[profile_country] => Россия
[profile_fan] => 1
[profile_gs] => 1
[profile_v] => 1
[age] => --
[userreference] => Array
(
)
[user_activity_index] => 100.00000000000000000000
[content] => Array
(
[user_picture] => Array
(
[#weight] => -10
[#value] =>
iNFerNo аватар
[#title] =>
[#description] =>
[#printed] => 1
)
[Личная информация] => Array
(
[profile_realname] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_realname
)
[#title] => Реальное имя
[#value] => Олег
[#weight] => -10
[#type] => user_profile_item
[#printed] => 1
)
[profile_sex] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_sex
)
[#title] => Пол
[#value] => мужской
[#weight] => -9
[#type] => user_profile_item
[#printed] => 1
)
[profile_myself] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_myself
)
[#title] => О себе
[#value] =>
Яйца, табак, перегар и щетина...
[#weight] => -8
[#type] => user_profile_item
[#printed] => 1
)
[profile_birtday] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_birtday
)
[#title] => День рождения
[#value] => 20/03/1979 (32)
[#weight] => -7
[#type] => user_profile_item
[#printed] => 1
)
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#attributes] => Array
(
)
[#description] =>
[#type] => user_profile_category
[#weight] => -8
[#title] => Личная информация
[#children] =>
Реальное имя
Олег
Пол
мужской
О себе
Яйца, табак, перегар и щетина...
День рождения
20/03/1979 (32)
[#printed] => 1
)
[Место жительства] => Array
(
[#attributes] => Array
(
)
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#weight] => -7
[#title] => Место жительства
[profile_city] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_city
)
[#title] => Город
[#value] => Москва
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[profile_country] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_country
)
[#title] => Страна
[#value] => Россия
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[#type] => user_profile_category
[#children] =>
Город
Москва
Страна
Россия
[#printed] => 1
)
[Интересы] => Array
(
[#attributes] => Array
(
)
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#weight] => -6
[#title] => Интересы
[profile_hobby] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_hobby
)
[#title] => Хобби
[#value] => Сайтостроительство и Интернет
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[profile_music] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_music
)
[#title] => Любимая музыка
[#value] => Агата Кристи, ПТВП, The Matrixx, Алиса, Мумий Тролль
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[profile_movie] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_movie
)
[#title] => Любимые фильмы
[#value] => Криминальное чтиво, Пираты карибского моря
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[#type] => user_profile_category
[#children] =>
Хобби
Сайтостроительство и Интернет
Любимая музыка
Агата Кристи, ПТВП, The Matrixx, Алиса, Мумий Тролль
Любимые фильмы
Криминальное чтиво, Пираты карибского моря
[#printed] => 1
)
[orders] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#attributes] => Array
(
)
[#description] =>
[#weight] => -5
[#title] => Заказы
[link] => Array
(
[#tree] =>
[#parents] => Array
(
)
[#required] =>
[#attributes] => Array
(
)
[#value] => Нажмите здесь для просмотра Вашей истории заказов.
[#description] =>
[#type] => user_profile_item
[#title] =>
[#printed] => 1
)
[#type] => user_profile_category
[#children] =>
Нажмите здесь для просмотра Вашей истории заказов.
[#printed] => 1
)
[Контактная информация] => Array
(
[#attributes] => Array
(
)
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#weight] => -5
[#title] => Контактная информация
[profile_web] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_web
)
[#title] => Веб-сайт
[#value] => -----------------
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[profile_vkontakte] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_vkontakte
)
[#title] => вКонтакте
[#value] => --------------
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[profile_icq] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_icq
)
[#title] => ICQ
[#value] => 201962780
[#weight] => 0
[#type] => user_profile_item
[#printed] => 1
)
[#type] => user_profile_category
[#children] =>
Веб-сайт
--------------------
вКонтакте
-----------------
ICQ
201962780
[#printed] => 1
)
[Доп. информация] => Array
(
[profile_gs] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_gs
)
[#title] =>
[#value] => ----------------
[#weight] => -10
[#type] => user_profile_item
[#printed] => 1
)
[profile_fan] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_fan
)
[#title] =>
[#value] => -----------------
[#weight] => -9
[#type] => user_profile_item
[#printed] => 1
)
[profile_v] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => profile-profile_v
)
[#title] =>
[#value] => Я выездной фанат
[#weight] => -8
[#type] => user_profile_item
[#printed] => 1
)
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#attributes] => Array
(
)
[#weight] => -1
[#title] => Доп. информация
[#type] => user_profile_category
[#description] =>
[#children] =>
-----------
--------------
Я выездной фанат
[#printed] => 1
)
[content_profile] => Array
(
[#title] =>
[#description] =>
[#printed] => 1
)
[user_activity] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => user-activity
)
[#title] => Latest activity
[#value] =>
100.00%
[#type] => user_profile_item
[#printed] => 1
)
[userpoints] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#attributes] => Array
(
)
[#description] =>
[#title] => Баллы пользователя
[points] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#attributes] => Array
(
)
[#description] =>
[#title] => Баллы
[#value] => 166 - Просмотреть, Регулировать
[#type] => user_profile_item
[#printed] => 1
)
[#type] => user_profile_category
[#children] =>
Баллы
166 - Просмотреть, Регулировать
[#printed] => 1
)
[summary] => Array
(
[#description] =>
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[dgb] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#description] =>
[#attributes] => Array
(
[class] => dgb
)
[#title] => Гостевая
[#value] => Посмотреть последние записи гостевой
[#type] => user_profile_item
[#printed] => 1
)
[member_for] => Array
(
[#required] =>
[#tree] =>
[#parents] => Array
(
)
[#attributes] => Array
(
)
[#description] =>
[#title] => Время участия
[#value] => 1 год 4 недели
[#type] => user_profile_item
[#printed] => 1
)
[#attributes] => Array
(
[class] => user-member
)
[#weight] => 5
[#title] => История
[#type] => user_profile_category
[#children] =>
Гостевая
Посмотреть последние записи гостевой
Время участия
1 год 4 недели
[#printed] => 1
)
[privatemsg_send_new_message] => Array
(
[#tree] =>
[#parents] => Array
(
)
[#prefix] =>
[#suffix] =>
[#required] =>
[#attributes] => Array
(
)
[#value] => Отправить пользователю сообщение
[#weight] => 10
[#description] =>
[#type] => markup
[#title] =>
[#printed] => 1
)
)
[privatemsg_disabled] =>
[type] => user
[recipient] => 5
)
только тут инфа не включяя сск поля контент_профилес...
ну значит кидай сюда весь код который после