Author Topic: Next- // Previous-Buttons on User-Profil - Vor- und Zurückbottons im User-Profil  (Read 24459 times)

0 Members and 1 Guest are viewing this topic.

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Jetzt bekomme ich folgenden Fehler:

Code: [Select]
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Inetpub\wwwroot\photofrontal\member.php on line 1117
Egal ob Gäste, Fotografen oder Kunden, es sollen immer nur die Profile der Usergruppe 1 (Fotograf) angezeigt werden.

Registrierte User, die nicht dieser Usergruppe angehören, führen kein Profile. Darum sollen diese mit back/next nicht angezeigt werden.

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Kann mir jemand helfen? Vielleicht IcEcReaM?

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
[qcode]  // show next and previous profile link
  $sql ="SELECT * FROM ".USERS_TABLE." WHERE ".get_user_table_field("","user_id")." > $user_id AND ".get_user_table_field("","user_level")." = 1
         ORDER BY ".get_user_table_field("","user_id")." ASC
         LIMIT 0,1";
  $result_profile_next = $site_db->query_firstrow($sql);
  $sql ="SELECT * FROM ".USERS_TABLE." WHERE ".get_user_table_field("","user_id")." < $user_id AND ".get_user_table_field("","user_level")." = 1
         ORDER BY ".get_user_table_field("","user_id")." DESC
         LIMIT 0,1";
  $result_profile_previous = $site_db->query_firstrow($sql);
  $profile_next_userid = (isset($result_profile_next[$user_table_fields['user_id']]) && $result_profile_next[$user_table_fields['user_id']]> GUEST) ? $result_profile_next[$user_table_fields['user_id']] : 0;
  $profile_previous_userid = (isset($result_profile_previous[$user_table_fields['user_id']]) && $result_profile_previous[$user_table_fields['user_id']]> GUEST) ? $result_profile_previous[$user_table_fields['user_id']] : 0;

  $site_template->register_vars(array(
      "profile_next_link" => ($profile_next_userid) ? "<a href=\"".$site_sess->url(ROOT_PATH."profile.php?action=showprofile&amp;".URL_USER_ID."=".$profile_next_userid)."\">Next Profile</a>" : "",
      "profile_previous_link" => ($profile_previous_userid) ? "<a href=\"".$site_sess->url(ROOT_PATH."profile.php?action=showprofile&amp;".URL_USER_ID."=".$profile_previous_userid)."\">Previous Profile</a>" : "",
  ));
  // show next and previous profile link[/qcode]

Sorry, hatte den Thread schon wieder vergessen.
Evtl. musst du rot markierte Zahl anpassen entsprechend deiner Usergruppe.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Das ganze scheint nicht so einfach zu sein.... nun sehe ich die Links "Next Profile" und "Previous Profile" nicht mehr.

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
weil userlevel=1 normalerweise auch (in der standard config) nur user haben,
die noch nicht aktiviert wurden.

du musst du 1 dann evtl. noch austauschen mit der usergruppe,
die angezeigt werden soll.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Aber Userlevel und Usergroup sind doch zwei ganz verschiedene Sachen, oder?
Ich möchte registrierte User, die der Usergroupen-ID 1 gehören anzeigen.

Ich weiss nicht, was der Wert für Userlevel=Registrierter User ist.
Aber der Wert meiner Usergroup ist 1.

Oder habe ich da was völlig missverstanden?  :oops:

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
achso jetzt hab ich dich erst verstanden,
dachte immer du willst nur User mit nem bestimmten Userlevel anzeigen lassen,
hab an sowas wie die Usergruppen gar nicht mehr gedacht, da ich das nicht nutze.

Dann müsstest du etwas warten, da ich mir dazu nochmal die Zusammenhänge anschauen muss,
und das ganze über nen komplizierteren JOIN SELECT lösen muss.
Hab nur derzeit keine Zeit dafür.
(weiss, dass ich es damals für nen ACP Mod schon etwas kompliziert lösen musste).
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
OK, dann warte ich auf den komplizierteren JOIN SELECT   :wink:

Danke dir jetzt schon für deine Hilfe!

Gruss
TIMT

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
kann aber noch dauern,
wie gesagt, der Join an sich ist nicht kompliziert,
nur weiss ich aus dem Kopf nicht mehr die Beziehungen der verschienden Gruppen Tabellen aus dem Kopf,
und bis ich Zeit hab mir das anzuschauen, dauert es noch etwas,
da ich die Tage erstmal an anderen Sachen arbeite.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Hab mir das gerade eben nochmal angeschaut,
hatte mich geirrt,
das komplizierte waren nicht die Gruppen,
sondern nur die Gruppenrechte bei bestimmten Abfragekonstellationen.

Versuch das mal hier:
Code: [Select]
  // show next and previous profile link
  $sql ="SELECT ".get_user_table_field("u.","user_id").get_user_table_field(",u.","user_name")."
         FROM ".USERS_TABLE." u
         LEFT JOIN ".GROUP_MATCH_TABLE." m ON (".get_user_table_field("u.","user_id")." = m.user_id)
         WHERE ".get_user_table_field("u.","user_id")." > $user_id AND m.group_id = 1
         ORDER BY ".get_user_table_field("","user_id")." ASC
         LIMIT 0,1";
  $result_profile_next = $site_db->query_firstrow($sql);
  $sql ="SELECT ".get_user_table_field("u.","user_id").get_user_table_field(",u.","user_name")."
         FROM ".USERS_TABLE." u
         LEFT JOIN ".GROUP_MATCH_TABLE." m ON (".get_user_table_field("u.","user_id")." = m.user_id)
         WHERE ".get_user_table_field("u.","user_id")." > $user_id AND m.group_id = 1
         ORDER BY ".get_user_table_field("","user_id")." DESC
         LIMIT 0,1";
  $result_profile_previous = $site_db->query_firstrow($sql);
  $profile_next_userid = (isset($result_profile_next[$user_table_fields['user_id']]) && $result_profile_next[$user_table_fields['user_id']]> GUEST) ? $result_profile_next[$user_table_fields['user_id']] : 0;
  $profile_previous_userid = (isset($result_profile_previous[$user_table_fields['user_id']]) && $result_profile_previous[$user_table_fields['user_id']]> GUEST) ? $result_profile_previous[$user_table_fields['user_id']] : 0;

  $site_template->register_vars(array(
      "profile_next_link" => ($profile_next_userid) ? "<a href=\"".$site_sess->url(ROOT_PATH."profile.php?action=showprofile&amp;".URL_USER_ID."=".$profile_next_userid)."\">Next Profile</a>" : "",
      "profile_previous_link" => ($profile_previous_userid) ? "<a href=\"".$site_sess->url(ROOT_PATH."profile.php?action=showprofile&amp;".URL_USER_ID."=".$profile_previous_userid)."\">Previous Profile</a>" : "",
  ));
  // show next and previous profile link

Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
das sieht doch schon viel besser aus.

eine kleine unschönheit gibt es noch ... wenn ich beim Profil mit der höchsten ID angelangt bin, wird der "Zurück-Button" nicht mehr angezeigt.

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
nicht nur das, da war auch nen anderer fehler noch drin,
dass passiert wenn man alles per copy and paste macht,
nur damit man paar zeichen schreiben spart.

der obere und der untere code sind gleich,
das sollte aber so nicht sein.
hier der richtige code:
[qcode]
  // show next and previous profile link
  $sql ="SELECT ".get_user_table_field("u.","user_id").get_user_table_field(",u.","user_name")."
         FROM ".USERS_TABLE." u
         LEFT JOIN ".GROUP_MATCH_TABLE." m ON (".get_user_table_field("u.","user_id")." = m.user_id)
         WHERE ".get_user_table_field("u.","user_id")." > $user_id AND m.group_id = 1
         ORDER BY ".get_user_table_field("","user_id")." ASC
         LIMIT 0,1";
  $result_profile_next = $site_db->query_firstrow($sql);
  $sql ="SELECT ".get_user_table_field("u.","user_id").get_user_table_field(",u.","user_name")."
         FROM ".USERS_TABLE." u
         LEFT JOIN ".GROUP_MATCH_TABLE." m ON (".get_user_table_field("u.","user_id")." = m.user_id)
         WHERE ".get_user_table_field("u.","user_id")." < $user_id AND m.group_id = 1
         ORDER BY ".get_user_table_field("","user_id")." DESC
         LIMIT 0,1";
  $result_profile_previous = $site_db->query_firstrow($sql);
  $profile_next_userid = (isset($result_profile_next[$user_table_fields['user_id']]) && $result_profile_next[$user_table_fields['user_id']]> GUEST) ? $result_profile_next[$user_table_fields['user_id']] : 0;
  $profile_previous_userid = (isset($result_profile_previous[$user_table_fields['user_id']]) && $result_profile_previous[$user_table_fields['user_id']]> GUEST) ? $result_profile_previous[$user_table_fields['user_id']] : 0;

  $site_template->register_vars(array(
      "profile_next_link" => ($profile_next_userid) ? "<a href=\"".$site_sess->url(ROOT_PATH."profile.php?action=showprofile&amp;".URL_USER_ID."=".$profile_next_userid)."\">Next Profile</a>" : "",
      "profile_previous_link" => ($profile_previous_userid) ? "<a href=\"".$site_sess->url(ROOT_PATH."profile.php?action=showprofile&amp;".URL_USER_ID."=".$profile_previous_userid)."\">Previous Profile</a>" : "",
  ));
  // show next and previous profile link[/qcode]

siehe rotes "<"
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Thanks! It works perfect!  :D