Piwigo Bugtracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000173Piwigodatabasepublic2005.10.12 12:032005.10.22 09:55
Assigned Toplg 
PlatformOSOS Version
Product Version1.5.0RC1 
Target VersionFixed in Version1.5.0RC2 
Summary0000173: Register
DescriptionWhen a user want to register himself from the gallery, the database is not written correctly. The problem seems to come from the id_user : 0 is free but in a phpbb forum 0 is forbiden.

Moreover is it really possible to register in the forum database from the gallery ? It will be great but not really easy nor urgent.

INSERT INTO phpwebgallery_user_infos (user_id,status,template,nb_image_line,nb_line_page,language,recent_period,expand,show_nb_comments,maxwidth,maxheight,registration_date)
  (NULL,'guest','black','4','10','fr_FR.iso-8859-1','7','false','true',NULL,NULL,'2005-10-12 13:53:03');
[mysql error 1048] Column 'user_id' cannot be null
TagsNo tags attached.
Database engine and version
PHP version
Web serverApache 1.3.x
Attached Files

- Relationships
related to 0000172closedplg Changement de mots de passe quand base users phpBB 

-  Notes
plg (manager)
2005.10.12 21:16

> Moreover is it really possible to register
> in the forum database from the gallery ?

That's a good question. when I wondered about it, I thought "let's decide with users". You're one of the first main user of the external users feature and your opinion counts a lot to me.

My opinion is that "register" and "password forgotten" features should be linked to the registration tool of your website. For example, the registration page of your phpBB forum.

The problem is that when clicking on "register" in PWG, you're redirected to phpBB, how will come back to PWG?
plg (manager)
2005.10.17 21:36
edited on: 2005.10.17 21:37

Reminder sent to: Vassae, noiry


I'm waiting for your advise/opinion concerning this particular entry.


noiry (reporter)
2005.10.18 15:39

Well, sorry for the delay, but I hadn’t realise that you were waiting for my contribution.

So, to focus on our problem, I'm not sure that using an external registration form (and so 'lost password' and ...) is a good idea. I will argue my opinion by giving you a case study : mine.

I have a phpBB forum that I use to discuss with some of my friends. I also have a PWG gallery to share pictures and videos. Before PWG 1.5.RC1, both of those two systems gathered about 50 different users (in fact, users coming from phpBB are used to log with a generic login/password). Since PWG 1.5.RC1, they can use their own login to enter into the gallery and that's the reason why it's a great feature.

BUT ! (there is always a but) I don't want to merge the two systems. In fact, I don't want first to let PWG users access my forum and second to require new PWG users to complete the phpBB registration page. That's why I would like to keep both registration systems.

In my case, I've created two different status in PWG (phpwebgallery_user_infos table): 'phpBB' for users coming from the forum and the original one ('guest') for those registered in PWG. Consequently, I can use the filtering tools to sort users by status, and manage them efficiently. I didn't implement it, but when creating an entry for user from phpBB, it could be good to set status' user to 'phpBB' which could be a variable define in config_local.inc.php (ex : $conf[users_ext_status] = 'phpBB').

For your information, I've used in phpBB an item of their table (user_active) which is used to control users’ registration. The PWG's users are not active and so they can't log on the forum.

So... that's my solution. I don't if it will fit to the project but for sure, it solves zorglub's problem : how to come back in PWG after phpBB registration... :)
plg (manager)
2005.10.18 22:10
edited on: 2005.10.18 22:11

OK, let's try to make registration work even when users table is not the PhpWebGallery users table :-)

During registration (include/functions_user.inc.php::register) the insert (made with mass_inserts function) seems to fail. I'm not sure, because the insert query (into phpbb_users) should have been catched. Standard function mysql_insert_id() should return the numeric identifier of the new user. For some reason, this identifier is not returned :-( Maybe I should use another technique for retrieving the id of the new user, get_userid for example.

Can you activate show_queries configuration parameter by adding :

$conf['show_queries'] = true;

in include/config_local.inc.php

Try to register a new user and read the insert query into phpbb_users table. Verify in this table (with PhpMyAdmin) that the new user is well registered.

Why do you talk about user_id = 0 ? (0 is very different from NULL)

Vassae (reporter)
2005.10.19 23:04
edited on: 2005.10.19 23:05

This is the end of the debug lines :

(this query time : 0.012 s)
(total SQL time : 0.039 s)
INSERT INTO phpwebgallery_user_infos
(NULL,'guest','black','4','3','fr_FR.iso-8859-1','7','false','false',NULL,NULL,'2005-10-20 01:01:16')
[mysql error 1048] Column 'user_id' cannot be null

and the new line in phpbb table :
"user_id user_active username
0 1 tata"

In phpbb, the user_id can't be equal to 0. But it's not the same problem.

plg (manager)
2005.10.20 11:29

Can you please extract the SQL statement to create the phpbb_users table? I believe that the user_id is not auto_increment or primary key, and consequently, mysql_insert_id PHP function returns nothing.

If this is the case, PhpWebGallery registration will only insert users with user_id 0. We would have to copy the registration procedure from phpBB code (which is not what I want to do...).
noiry (reporter)
2005.10.20 12:20

damned !!: You're right...

I forgot that I've changed the increment method of user_id in phpBB user table... and phpBB is still working...

Could we recommend that to people who wants to use external users table ?
Vassae (reporter)
2005.10.20 18:06

Index: Documentation
Nom de la clé Type Cardinalité Action Champ
PRIMARY PRIMARY 5 Modifier Supprimer user_id

but user_id is not auto_increment.

Moreover this is the way in phpbb to edit the database (I hope I don't make a mistake... I'm not sure). If it's the good part of the file, it seems that they don't use the same syntax like you.

            $sql = "SELECT MAX(user_id) AS total
                FROM " . USERS_TABLE;
            if ( !($result = $db->sql_query($sql)) )
                message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);

            if ( !($row = $db->sql_fetchrow($result)) )
                message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
            $user_id = $row['total'] + 1;
plg (manager)
2005.10.22 09:55

Bug corrected by modifying the method to find the next user id. Max+1 instead of inserted auto_increment column.

- Issue History
Date Modified Username Field Change
2005.10.12 12:03 Vassae New Issue
2005.10.12 12:03 Vassae browser => any
2005.10.12 12:03 Vassae Web server => Apache 1.3.x
2005.10.12 21:16 plg Note Added: 0000284
2005.10.12 21:16 plg Assigned To => plg
2005.10.12 21:16 plg Status new => feedback
2005.10.12 21:17 plg Relationship added related to 0000172
2005.10.17 21:36 plg Note Added: 0000290
2005.10.17 21:37 plg Note Edited: 0000290
2005.10.18 15:39 noiry Note Added: 0000292
2005.10.18 22:10 plg Note Added: 0000295
2005.10.18 22:11 plg Note Edited: 0000295
2005.10.19 23:04 Vassae Note Added: 0000310
2005.10.19 23:05 Vassae Note Edited: 0000310
2005.10.20 11:29 plg Note Added: 0000314
2005.10.20 12:20 noiry Note Added: 0000315
2005.10.20 18:06 Vassae Note Added: 0000316
2005.10.22 09:55 plg Note Added: 0000320
2005.10.22 09:55 plg Status feedback => closed
2005.10.22 09:55 plg Resolution open => fixed
2005.10.22 09:55 plg Fixed in Version => 1.5.0RC2

Copyright © 2000 - 2015 MantisBT Team
Powered by Mantis Bugtracker