• [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien 4 0 5 1
Currently:  

Author Topic: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien  (Read 230229 times)

0 Members and 1 Guest are viewing this topic.

Offline Jockl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • fanpage-der-wiener-linien
Hallo Leute!

Erstmals ein wirklicher toller Mod, nach sowas habe ich lange gesucht.

Mein Problem ist aber, dass ich keine statische Liste von Kategorien haben will, in denen die User die Kategorien selber erstellen können, sondern dass diese Liste immer aktualisiert wird. In der addcat.html habe ich die option values durch "{auswahl}" ersetzt.

In der addcat.php habe ich die SQL-Abfrage eingebaut, die auch gut funktioniert.

Code: [Select]
  $sql = $site_db->query("SELECT cat_id, cat_name FROM 4images_categories WHERE cat_parent_id = 2"); 
  while ($row = $site_db->fetch_array($sql))
  {
  $auswahl .= "<option value=\"".$row['cat_id']."\">".$row['cat_name']."</option>";
  }

Bei

Code: [Select]
$site_template->register_vars(array(
habe ich

Code: [Select]
"auswahl" => $auswahl,
eingefügt. Trotzdem erscheinen im Dropdown nicht die gewünschten Kategorien. Wo liegt mein Fehler?

LG, Jockl

Offline KillerCookie

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hallo,

was verstehst du denn unter "funktioniert gut"? Hast du dir das Ergebnis deiner Abfrage mal per echo ausgeben lassen? Stimmt der Inhalt?

Bei

Code: [Select]
"auswahl" => $auswahl,
ist das Komma am Ende zuviel, sofern es am Ende der Liste steht. Wenn nicht, dann ist das ganze OK so.

Quote
Trotzdem erscheinen im Dropdown nicht die gewünschten Kategorien. Wo liegt mein Fehler?

Was erscheint denn statt dessen? Nichts? dann siehe meinen 1. Satz.

MfG Maik


Offline KillerCookie

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hallo,

es gibt gute und schlechte Neuigkeiten. Fangen wir mal an:

1. Gut: Ich bin jetzt Fachinformatiker für Systemintegration, da ich meine Facharbeiterprüfung recht gut bestanden habe.
2. Schlecht: Ich bin jetzt erstmal arbeitslos, da es in meiner Gegend nicht zu gut um Arbeitsplätze dieser Branche bestellt ist.
3. Gut: Ich werde ab nächste Woche mit der (Neu-) Entwicklung von Addcat V2 beginnen. Die fertige Version gibt es aber erst "when it´s done".

Also: Feature requests und alles sonstige, was zum Thema passt bitte hier posten, ich lese ständig mit. Sollte jemand einen Mitarbeiter für sein Unternehmen suchen: Ich bewerbe mich gerne. ;)

An die Arbyte...

Offline rubberduck

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • Reptilienmanager.de
1. Gut: Ich bin jetzt Fachinformatiker für Systemintegration, da ich meine Facharbeiterprüfung recht gut bestanden habe.

Na dann meinen herzlichsten Glückwunsch! Und in Bezug auf die Arbeitsstelle ... das wird schon!

ReptilienManager.de - Die Online Reptilien Verwaltung
Neueinsteiger.eu - Das Portal für Terraristik Einsteiger
Terra-ROW.de - Der regionale Terraristik Stammtisch in Rotenburg

Offline Holger2

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #124 on: September 29, 2008, 01:21:13 PM »
Hallo!

Ist an dem Mod noch was passiert seit Juli? :D
Dies ist genau das was ich brauche. Wäre echt klasse, wenn Du es veröffentlichen würdest! :D

Gruss
Holger

Offline Holger2

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #125 on: September 29, 2008, 02:40:54 PM »
Ich habe den Mod 1.3 installiert. Klappt auch hervorragend.
Nur: ich benutze ein anderes Template. Die Anpassung gestaltet sich schwierig.
UND: Bilder, die in den von Benutzern angelegten Kategorien hochgeladen wurden, werden auf der Index-Seite nicht unter New Photos gelistet.

Offline Gazzagreen

  • Newbie
  • *
  • Posts: 25
  • trying to get things to go my way :)
    • View Profile
    • LoveMansfield.co.uk Social website
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #126 on: September 30, 2008, 02:52:10 AM »
Step 1 / Schritt 1
Download the attached File
Lade die Datei im Anhang herunter

Where can i find the attached file?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #127 on: September 30, 2008, 02:59:46 AM »
...  :roll: ...
... wie der Name schon sagt, angehangene Datei ... eventuell am Ende des Posts ...
... da wurde sie zumindest schon 372 mal heruntergeladen ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #128 on: September 30, 2008, 03:03:30 AM »
Where can i find the attached file?

Hello and welcome to 4images forum.

The attached files are located at the bottom of the post (not page). This is a standard place for all forums ;)

P.S.
ops, mawenzi beat me :)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Gazzagreen

  • Newbie
  • *
  • Posts: 25
  • trying to get things to go my way :)
    • View Profile
    • LoveMansfield.co.uk Social website
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #129 on: September 30, 2008, 03:33:03 AM »
Many thanks :)

Offline Gazzagreen

  • Newbie
  • *
  • Posts: 25
  • trying to get things to go my way :)
    • View Profile
    • LoveMansfield.co.uk Social website
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #130 on: September 30, 2008, 12:51:31 PM »
hello

I was thinking, as a tempary solution to allow just the author to upload pictures to the new category he has made, is it possible to alter the upload button to just allow the author to upload from the new category page.

To help with this I have changed this...

in addcat.php added new entry to database called cat_author. This will contain the login name of the member who created the database. (needs to enter cat_author the categories database)

  $sql = "INSERT INTO gallery_categories   (
          cat_id,
          cat_name,
          cat_description,
          cat_parent_id,
                                    cat_author ,    //****new
          cat_hits,
          cat_order,
          auth_viewcat,
          auth_viewimage,
          auth_download,
          auth_upload,
          auth_directupload,
          auth_vote,
          auth_sendpostcard,
          auth_readcomment,
          auth_postcomment
         )
    VALUES
         (
          '$new_cat_id',
          '$new_cat_name',
          '$new_cat_description',
          '$cat_parent_id',
                       '$user_name',                                 //****new
          '$cat_hits',
          '$new_cat_order',
          '$auth_viewcat',
          '$auth_viewimage',
          '$auth_download',
          '$auth_upload',
          '$auth_directupload',
          '$auth_vote',
          '$auth_sendpostcard',
          '$auth_readcomment',
          '$auth_postcomment'
          )";

Now all that is need is a small script to just allow the user that is logged in, to match the name in the database (cat_author) for the upload button to appear. If another member visits the page, the upload button is greyed out?

I tried this so that if it worked I could have entered into the upload_button script, but it didn't work;

if($cat_cache['cat_author']== "$user_name")
{
$test = "test";
}

What do you think, can this be done?

All the best
Gary

Offline Gazzagreen

  • Newbie
  • *
  • Posts: 25
  • trying to get things to go my way :)
    • View Profile
    • LoveMansfield.co.uk Social website
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #131 on: October 01, 2008, 01:51:56 AM »
I'm trying to get this statement to work below.

$test2 = "SELECT * FROM gallery_categories WHERE cat_id = '$cat_id'";
$test = $test2[cat_hits];

Any ideas how i can get info from the database using something like this?

many thanks
Gary

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #132 on: October 01, 2008, 02:06:12 AM »
try:
$test $cat_cache[$cat_id]['cat_hits'];
if this line is inside a function or inside a template you'll need add above it:
global $cat_cache;
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Gazzagreen

  • Newbie
  • *
  • Posts: 25
  • trying to get things to go my way :)
    • View Profile
    • LoveMansfield.co.uk Social website
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #133 on: October 01, 2008, 02:40:54 AM »
try:
$test $cat_cache[$cat_id]['cat_hits'];
if this line is inside a function or inside a template you'll need add above it:
global $cat_cache;

Many thanks for this.

I have inserted a new field into table, "gallery_categories" called cat_author. This statement you sent works with all other fields except the new one. Seems there is somehwhere I have to update so that the new table is recognised.

Do you know where?

If I can get this to work, I might be able to add some simple code to the upload button so that only the member that made the new category can upload to it :)

All the best.
gary

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
« Reply #134 on: October 01, 2008, 03:51:41 AM »
You'll need add it to the list in global.php:
Code: [Select]
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)