Author Topic: User Guest in 4images Users Table  (Read 4690 times)

0 Members and 1 Guest are viewing this topic.

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
User Guest in 4images Users Table
« on: February 05, 2006, 07:26:00 AM »

As seen in the description.
Is the "user" Guest in the 4images users table really needed?
(I mean user_id -1)

The reason why i asking, is that i coding a mod for me,
to integrate my board/forum (wbb2) in 4 images,
and i didn't seen any reason yet, if this user is needed,
cause i want to use the board users table,
and there the userid is unsigned, so no negative values can used for userid.

By the way.
The gallery is really nice coded.
I wanted only some few modifications,
but after a while, as i made some modifications,
i could see, that its not really hard to integrate a board to gallery,
because you can modify the configs from the gallery really easy
and not necassery to modify all sites. :D
Great work.
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 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: User Guest in 4images Users Table
« Reply #1 on: February 05, 2006, 07:53:46 AM »
There are some values, such as user_level, user_name are needed, but basicaly you can do without guest entry in the database and load all defaults from within sessions.php (hardcode that data)...
but I'd probably would just remove the "unsigned" attribut of the table instead ;)
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 IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: User Guest in 4images Users Table
« Reply #2 on: February 05, 2006, 09:31:57 AM »
But as i have seen it correctly, the values like user_level for the Level Guest are given by the
value in the constants.php,
user_name is given through the language files,
so I haven't found yet a piece of code, where the entry in the database for guest is needed.
Might be that i havent found it yet,
may be u can give me an example?

In the sessions.php is also only needed the values for userlevel guest given by constants.php
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 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: User Guest in 4images Users Table
« Reply #3 on: February 05, 2006, 10:04:22 AM »
The values in constants.php is only for the representation of the real numbers so if one ever need to change those values, only one file needs to be modifyed wich will affect the entire script.
What you see in language files are only for displaying on the page, these has nothing to do with your question ;)
so, basicaly since "unsign" type of field can contein number 0, you can simply use 0 for the guest account instead of -1 ;) just update it in constants.php
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 IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: User Guest in 4images Users Table
« Reply #4 on: February 05, 2006, 08:16:29 PM »
Jep, thats what i mean.
the "unmodified" 4images script reads the valies for the settings for userlevel Guest on the fly given by constants.php

I have found now only a  mod from you (last comments on index),
what has problems with old entries if you change the userlevel for GUEST from -1 to 0.

For example:
Post a comment as guest for one picture.
Know you can see the username, entered by guest, correctly on the index (last comments) and in details page.
When you know change the value for Userlevel Guest in constants.php from -1 to 0,
in the details page the username entered by guest is shown correctly,
but not in the last comments area on the index site.

So as i guess, this change effect only some mods,
the 4images site doesnt read the data from guest from the users_table.

P.S.: i changed the userlevel for guest in constants.php to 0,
and had no problems.
Hust had to modify several mods, that aren't coded really 4images compatilbe.

I asked here this specific question only because i wanted to know the behaviour about the guest entry.

thx for your help.
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
Re: User Guest in 4images Users Table
« Reply #5 on: February 06, 2006, 09:12:36 PM »
So finally i found out,
that the entry is not really neccessary (the guest entry in users_table),
if you only use the original 4images code,
otherwise it helps after setting the Guest level in constants.php from -1 to 0,
just update automaticcly with a script the other tables like comments/images
where old entries a set or user_id = -1 to 0,
then there should be really no problems.

The reason why i asked, that i could find a bit of code,
where the guest entry in is needed,
cause 4images is build like this in sessions.php:

read Userinfo (like userid, name, userlevel...)

if (userlevel != guest) {
here code for doing things with registred users
}
else
lang_guest  (from main.php language files the username for guest is read)
user_id = regarding to the setting from constants.php for guest level
user_level =  regarding to the setting from constants.php for guest level

as you can see all entries for user guest are coming from the constants.php

Maybe the guest entry in users_table is from previous versions of 4images...^^


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