Startseite
  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche
Startseite › Forum › Drupalcenter.de › Anfängerfragen ›

User Profiles Version 1

Eingetragen von hossi (9)
am 11.10.2008 - 17:02 Uhr in
  • Anfängerfragen
  • Drupal 5.x

Hallo!

Bin gerade dabei ein Userprofil nach dem "User Profiles Version 1" tutorial
http://shellmultimedia.com/tutorials/user-profiles-version-1

von michelle zu erstellen.

Soweit, so gut.

Bin so gut wie fast fertig, habe aber ein kleines problem mit dem Einfügen der Codes in die Template.php. Benutze das Garaland standart template von drupal.

Immer wenn ich die Codes einfüge, kommt irgendein Fehler in einer Zeile. Bin schon fast am verzweifeln, wenn ich versuche den Fehler zu beseitigen, kommt er an einer neuen stelle...

hier mal den code, so wie ich ihn eingefügt habe nach dem Tutorial...:

momentaner error: Parse error: syntax error, unexpected $end in /var/www/web18/web/themes/garland/template.php on line 179
und: Fatal error: Cannot redeclare phptemplate_views_view_list_buddylist_of_uid() (previously declared in /var/www/web18/web/modules/advanced_profile/advanced_profile.module:436) in /var/www/web18/web/themes/garland/template.php on line 158

<?php
// $Id: template.php,v 1.4.2.1 2007/04/18 03:38:59 drumm Exp $

/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
  if ($sidebar_left != '' && $sidebar_right != '') {
    $class = 'sidebars';
  }
  else {
    if ($sidebar_left != '') {
      $class = 'sidebar-left';
    }
    if ($sidebar_right != '') {
      $class = 'sidebar-right';
    }
  }

  if (isset($class)) {
    print ' class="'. $class .'"';
  }
}

/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
*   An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  }
}

/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
  static $node_type;
  if (isset($type)) $node_type = $type;

  if (!$content || $node_type == 'forum') {
    return '<div id="comments">'. $content . '</div>';
  }
  else {
    return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
  }
}

/**
* Override or insert PHPTemplate variables into the templates.
*/
//function _phptemplate_variables($hook, $vars) {
//  if ($hook == 'page') {
    if (arg(0) == 'user') {
      $vars['tabs'] = str_replace('Edit</a>', 'Edit Account</a>', $vars['tabs']);
    }
//    return $vars;
//  }
//}

/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
*
* @ingroup themeable
*/
function phptemplate_menu_local_tasks() {
  $output = '';

  if ($primary = menu_primary_local_tasks()) {
    $output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
  }

  return $output;
}


// >>>>>>>>>>>>>>>>>AB HIER HAB ICH ALLES EINGEFÜGT!!!<<<<<<<<<<<<<<<<<<


// Override the display of the nodeprofile to just show the node itself and not the surrounding markup or the tabs.
// Theming of the nodeprofile will be handled separately. Note that this affects it wherever it is displayed and
// not only on the user page.
function phptemplate_nodeprofile_display_box($element, $content) {
  $head = isset($element['#title']) ? '<h2 class="nodeprofile-title">'. check_plain($element['#title']) .'</h2>' : '';

  return $content;
}

// Override the entire user account view page to not show the categories or to seperate items into divs.
// Note that this is set up to still show everything that is thrown on this page. Getting rid of non-nodeprofile
// sections is done in the node_profile_bonus module by unsetting them but could also be done here by conditionally
// printing them to begin with.
function phptemplate_user_profile($account, $fields) {
  foreach ($fields as $category => $items) {
    foreach ($items as $item) {
      $output .= $item['value'] ;
    }
  }

  // Returning nothing from this function causes the entire page to whitescreen, so let's put something in by default
  // A better idea might be to load up some sort of standard thing that has the views and just not the profile fields
  if (empty($output)) {
    $output = "This user has not filled out a user profile.";
  }

  return $output;
}

//2

function phptemplate_views_view_list_buddylist_of_uid($view, $nodes, $type) {
  $fields = _views_get_fields();

  $taken = array();

  // Set up the fields in nicely named chunks.
  foreach ($view->field as $id => $field) {
    $field_name = $field['field'];
    if (isset($taken[$field_name])) {
      $field_name = $field['queryname'];
    }
    $taken[$field_name] = true;
    $field_names[$id] = $field_name;
  }

  // Set up some variables that won't change.
  $base_vars = array(
    'view' => $view,
    'view_type' => $type,
  );

  foreach ($nodes as $i => $node) {
    $vars = $base_vars;
    $vars['node'] = $node;
    $vars['count'] = $i;
    $vars['stripe'] = $i % 2 ? 'even' : 'odd';
    foreach ($view->field as $id => $field) {
      $name = $field_names[$id];
      $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
      if (isset($field['label'])) {
        $vars[$name . '_label'] = $field['label'];
      }
    }
    $items[] = _phptemplate_callback('views-list-buddylist_of_uid', $vars);
  }
  if ($items) {
  //MAC Instead of returning an item list, we just seperate with spaces
  //return theme('item_list', $items);
  return implode(" ",$items);
  }
}

//3
// These overrides load custom .tpl files to handle the guestbook display as a whole, a single entry display, and the input form
function phptemplate_guestbook($uid, $entries, $comment_entry, $limit = 20) {
  return _phptemplate_callback('guestbook', array('uid'=>$uid, 'entries'=>$entries, 'comment_entry' => $comment_entry, 'limit' => 20));
}

function phptemplate_guestbook_entry($uid, $entry, $comment_entry = NULL, $confirm_delete = false) {
  return _phptemplate_callback('guestbook-entry', array('uid'=>$uid, 'entry'=>$entry, 'comment_entry' => NULL, 'confirm_delete' => false));
}

function phptemplate_guestbook_form_entry_form($form) {
  return _phptemplate_callback('guestbook-form-entry-form', array('form'=>$form));
}


//4
function phptemplate_node_form($form) {
   if ($form['#node']->type == 'uprofile') {
     return _phptemplate_callback('node-uprofile-edit', array('form' => $form));
  }
  else {
     return theme_node_form($form);
  }
}

‹ Nach Update alte Version im Statusbericht Weitere Newsfeeds ›
  • Anmelden oder Registrieren um Kommentare zu schreiben

Benutzeranmeldung

  • Registrieren
  • Neues Passwort anfordern

Aktive Forenthemen

  • für drupal11 ein Slider Modul
  • [gelöst] W3CSS Paragraphs Views
  • Drupal 11 neu aufsetzen und Bereiche aus 10 importieren
  • Wie erlaubt man neuen Benutzern auf die Resetseite zugreifen zu dürfen.
  • [gelöst] Anzeigeformat Text mit Bild in einem Artikel, Drupal 11
  • Social Media Buttons um Insteragram erweitern
  • Nach Installation der neuesten D10-Version kein Zugriff auf Website
  • Composer nach Umzug
  • [gelöst] Taxonomie Begriffe zeigt nicht alle Nodes an
  • Drupal 11 + Experience Builder (Canvas) + Layout Builder
  • Welche KI verwendet ihr?
  • Update Manger läst sich nicht Installieren
Weiter

Neue Kommentare

  • melde mich mal wieder, da ich
    vor 1 Tag 9 Stunden
  • Hey danke
    vor 2 Tagen 4 Stunden
  • Update: jetzt gibt's ein
    vor 2 Tagen 22 Stunden
  • Hallo, im Prinzip habe ich
    vor 1 Woche 8 Stunden
  • Da scheint die Terminologie
    vor 1 Woche 11 Stunden
  • Kannst doch auch alles direkt
    vor 1 Woche 4 Tagen
  • In der entsprechenden View
    vor 1 Woche 4 Tagen
  • Dazu müsstest Du vermutlich
    vor 1 Woche 4 Tagen
  • gelöst
    vor 4 Wochen 1 Tag
  • Ja natürlich. Dass ist etwas,
    vor 4 Wochen 2 Tagen

Statistik

Beiträge im Forum: 250233
Registrierte User: 20449

Neue User:

  • Mroppoofpaync
  • 4aficiona2
  • AppBuilder

» Alle User anzeigen

User nach Punkten sortiert:
wla9461
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3924
ronald3857
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 17 Gäste online.

Hauptmenü

  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche

Quicklinks I

  • Infos
  • Drupal Showcase
  • Installation
  • Update
  • Forum
  • Team
  • Verhaltensregeln

Quicklinks II

  • Drupal Jobs
  • FAQ
  • Drupal-Kochbuch
  • Best Practice - Drupal Sites - Guidelines
  • Drupal How To's

Quicklinks III

  • Tipps & Tricks
  • Drupal Theme System
  • Theme Handbuch
  • Leitfaden zur Entwicklung von Modulen

RSS & Twitter

  • Drupal Planet deutsch
  • RSS Feed News
  • RSS Feed Planet
  • Twitter Drupalcenter
Drupalcenter Team | Impressum & Datenschutz | Kontakt
Angetrieben von Drupal | Drupal is a registered trademark of Dries Buytaert.
Drupal Initiative - Drupal Association