4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: mawenzi on July 10, 2008, 07:24:01 PM

Title: [MOD] Download Counter User Images in Profile
Post by: mawenzi on July 10, 2008, 07:24:01 PM
(http://img517.imageshack.us/img517/1378/deu8yc.gif) - zunächst einmal nur in deutsch ...
(http://img517.imageshack.us/img517/7821/eng9tu.gif) - a englisch version is coming soon ... or later ...  ;) ... meanwhile use this  English-Google-Translation (http://translate.google.com/translate?u=http%3A%2F%2Fwww.4homepages.de%2Fforum%2Findex.php%3Ftopic%3D22135.0&langpair=de%7Cen&hl=de&ie=UTF-8) ...
     - but don't use the php-/html-code from this translation, use the php-/html-code from the original topic ...

Vorbemerkung :

... die Anfrage für diese Modifizierung stammt von Mr Kennedy und ist hier (http://www.4homepages.de/forum/index.php?topic=22122.0) nachzulesen :  ...
... worum geht es konkret ... ?
... im User-Profil soll angezeigt werden, die Anzahl des Downloads von wievielen Bildern die der betreffende User hochgeladen hat ...
... das ist eine interessante statistische Auskunft, die ich so noch nicht hier im Forum für die 4images Galerie gefunden habe ...
... nach Installation dieser Modifizierung erscheint die folgende zusätzliche Zeile im User-Profil ... z.B. ...

Download von Bildern des Users:  gesamt 123 Downloads von 43 Bildern

... oder auch im Singular ...

Download von Bildern des Users:  gesamt 1 Download von 1 Bild

... oder auch die Kombination, wenn gegeben, aus beiden ...
... folgende Änderungen wären dazu durchzuführen ...

Installation :

1. Schritt
Öffne die Datei member.php und finde im Abschnitt //--- Show Profile ---- :
Code: [Select]
    else {
      $user_email = REPLACE_EMPTY;
      $user_email_save = REPLACE_EMPTY;
      $user_mailform_link = REPLACE_EMPTY;
      $user_email_button = REPLACE_EMPTY;
    }

und füge danach folgende Codezeilen ein
Code: [Select]
//--- Ab hier zusätzliche Infos im Benutzerprofil -----------------------------------------
//--- Download von Bildern des Users im Profil , von mawenzi , 10.07.2008 -----------------
    $sql = "SELECT SUM(image_downloads) AS sum_downloads
            FROM ".IMAGES_TABLE."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_id."";
    $row = $site_db->query_firstrow($sql);
    $sum_downloads = (isset($row['sum_downloads'])) ? $row['sum_downloads'] : 0;
    $sql = "SELECT COUNT(*) AS count_downloads
            FROM ".IMAGES_TABLE."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_id."
            AND image_downloads > 0";
    $row = $site_db->query_firstrow($sql);
    $count_downloads = (isset($row['count_downloads'])) ? $row['count_downloads'] : 0;
    $lang['lang_downloads'] = "Download von Bildern des Users:";
    $lang['lang_downloads_1'] = "gesamt";
    if ($sum_downloads == 1) {
        $lang['lang_downloads_2'] = "Download von";
    } else {
        $lang['lang_downloads_2'] = "Downloads von";
    }
    if ($count_downloads == 1) {
        $lang['lang_downloads_3'] = "Bild";
    } else {
        $lang['lang_downloads_3'] = "Bildern";
    }
    $site_template->register_vars(array(
      "lang_downloads" => $lang['lang_downloads'],
      "sum_downloads" => $lang['lang_downloads_1']." ".$sum_downloads." ".$lang['lang_downloads_2']." ".$count_downloads." ".$lang['lang_downloads_3'],
     ));
//--- Download von Bildern des Users im Profil , von mawenzi , 10.07.2008 -----------------

2.Schritt
Öffne die Datei templates/<dein_template>/member_profile.html und finde :
Code: [Select]
<tr>
          <td class="row1"><b>{lang_comments}</b></td>
          <td class="row1">{user_comments}</td>
</tr>

und füge danach folgende Codezeilen ein :
Code: [Select]
<tr>
          <td class="row2" ><b>{lang_downloads}</b></td>
          <td class="row2">{sum_downloads}</td>
</tr>

Die Template-Anpassung ist natürlich deine Sache, wobei ich noch auf die class="row2" hinweisen möchte, die entsprechend deinem Template und der Stelle, an der du die Profilerweiterung in die Tabelle einfügst, auch z.B. class="row1" oder noch anders benannt werden muss.

Den MOD in Aktion findet ihr u.a. auch auf meiner Seite ...   :wink:

mawenzi
Title: Re: [MOD] Download Counter User Images in Profile
Post by: Mr Kennedy on July 10, 2008, 08:15:39 PM
klasse, vielen dank  :)

edit: noch besser wäre er wenn das nur angezeigt wird wenns da auch was zum anzeigen gibt außer 0 Downloads von 0 Bildern  :mrgreen:
Title: Re: [MOD] Download Counter User Images in Profile
Post by: mawenzi on July 10, 2008, 08:16:47 PM
@ivan
... zunächst ... danke ...  8)
... auf den Hinweis mit den Sprachtags habe ich schon gewartet ...  :mrgreen:
... aber ich denke ... User, die eine Sprachauswahl anbieten (wie du), die wissen auch wie die {lang_tags} zu setzen sind ...
... etwas knifflig wird es sicher mit der Singular- / Plural-Sprachausgabe ...
... aber man kann das ja auch, wie sonst in 4images üblich, mit Klammern lösen ... z.B. ... Download(s) ... Bild(ern) ... ;)

@MrKennedy
... bitte ...  8)
... edit ... auch das geht natürlich ... aber 0 von 0 ist ja auch eine statistische Aussage ...
Title: Re: [MOD] Download Counter User Images in Profile
Post by: Mr Kennedy on July 10, 2008, 08:26:04 PM
Passt schon so ;)
Intressant wäre vllt noch dass da auch iwie die ganze Bildanzahl angezeigt wird

Download von Bildern des Users:    gesamt 18008 Downloads von 1922 Bildern

und dnan vllt iwie
Download von Bildern des Users:    gesamt 18008 Downloads von 1922 (gesamtanzahl) Bildern

Wenn das vllt iwie machtbar wäre  :wink:
Title: Re: [MOD] Download Counter User Images in Profile
Post by: mawenzi on July 10, 2008, 08:33:37 PM
@Mr Kennedy
... die Gesamtanzahl der vom User hochgeladenen Bilder für das User-Profil gibt es hier im Forum schon ...
... und auch weitere Ergänzungen für das User-Profile ...
... habe den Link aber jetzt nicht parat ... also mal ein bischen suchen ...
Title: Re: [MOD] Download Counter User Images in Profile
Post by: sanko86 on February 03, 2009, 08:05:09 PM
thank you

best mod

ý am use
Title: Re: [MOD] Download Counter User Images in Profile
Post by: mawenzi on February 03, 2009, 10:22:53 PM
... thanks softbal10 for your statement ... ;)
 
Title: Re: [MOD] Download Counter User Images in Profile
Post by: sanko86 on February 03, 2009, 10:31:13 PM
ı am sorry

my little english language

but ı understand;)

ı live in turkey.

4images fan:)
Title: Re: [MOD] Download Counter User Images in Profile
Post by: Pearl on February 04, 2009, 08:59:48 PM
Can someone translate this in english pls?
Download von Bildern des Users:gesamt 0 Downloads von 0 Bildern
Title: Re: [MOD] Download Counter User Images in Profile
Post by: mawenzi on February 04, 2009, 10:09:09 PM
Can someone translate this in english pls?
Download von Bildern des Users:gesamt 0 Downloads von 0 Bildern

... ok ... it is possible to misunderstand ... so, we are on the user-profile-site to read that after this modification ...
... and here is a short translation ...

image downloads of 'images by this user' : total 0 image downloads of total 0 'images from this user'

... that means ...
... downloads 'from all users' of images by 'this user from this profile' ...
... : ...
... there are no downloads 'from all users' of images by 'this user from this profile' ...
... and ...
... there are no images from 'this user from this profile' in your gallery ...

... please note each of the apostrophes ...
... maybe there is a better and shorter translation in english ... :oops:
Title: Re: [MOD] Download Counter User Images in Profile
Post by: Pearl on February 05, 2009, 01:31:39 AM
First of all thank you so much...is there a copy of this in english?



//--- Ab hier zusätzliche Infos im Benutzerprofil -----------------------------------------
//--- Download von Bildern des Users im Profil , von mawenzi , 10.07.2008 -----------------
    $sql = "SELECT SUM(image_downloads) AS sum_downloads
            FROM ".IMAGES_TABLE."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_id."";
    $row = $site_db->query_firstrow($sql);
    $sum_downloads = (isset($row['sum_downloads'])) ? $row['sum_downloads'] : 0;
    $sql = "SELECT COUNT(*) AS count_downloads
            FROM ".IMAGES_TABLE."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_id."
            AND image_downloads > 0";
    $row = $site_db->query_firstrow($sql);
    $count_downloads = (isset($row['count_downloads'])) ? $row['count_downloads'] : 0;
    $lang['lang_downloads'] = "Download von Bildern des Users:";
    $lang['lang_downloads_1'] = "gesamt";
    if ($sum_downloads == 1) {
        $lang['lang_downloads_2'] = "Download von";
    } else {
        $lang['lang_downloads_2'] = "Downloads von";
    }
    if ($count_downloads == 1) {
        $lang['lang_downloads_3'] = "Bild";
    } else {
        $lang['lang_downloads_3'] = "Bildern";
    }
    $site_template->register_vars(array(
      "lang_downloads" => $lang['lang_downloads'],
      "sum_downloads" => $lang['lang_downloads_1']." ".$sum_downloads." ".$lang['lang_downloads_2']." ".$count_downloads." ".$lang['lang_downloads_3'],
     ));
//--- Download von Bildern des Users im Profil , von mawenzi , 10.07.2008 -----------------
Title: Re: [MOD] Download Counter User Images in Profile
Post by: mawenzi on February 05, 2009, 01:42:29 AM
... at time only here ... http://www.4homepages.de/forum/index.php?topic=22135.msg131903#msg131903 ...
Title: Re: [MOD] Download Counter User Images in Profile
Post by: paule on April 08, 2009, 08:35:04 PM
Hallo,

ich habe alles geändert und bekomme aber leider folgende Fehlermeldung:
Parse error: syntax error, unexpected T_STRING in /var/www/member.php on line 939 (siehe Anhang)

Was tun?

Gruß paule