[solved] user added in db is not seen on one adminpage, but not on the other?

Discussion forum for Extension Writers regarding Extension Development.
carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

[solved] user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Wed Jan 07, 2015 11:38 am

I'm working on a converter and am trying to add a user to the database. I got pretty much all the data in and added a row for the user in the usergroups table.

In the admin panel 'users & groups' > 'manage users' I can not find the new user, but when clicking on the link 'Find a member' the user shows, but can not be selected.

What am I overlooking in adding a user to the database?
Last edited by carsten88888 on Fri Jan 16, 2015 7:35 am, edited 3 times in total.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: user added in db is not seen on one adminpage, but not on the other?

Post by RMcGirr83 » Wed Jan 07, 2015 12:09 pm

You added them to the users table too?
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Wed Jan 07, 2015 1:00 pm

to the users table and to the groups table.
You have specified an incorrect username. Please check your username and try again. If you continue to have problems please contact the Board Administrator.
Can't login with the new user, so something is not right. But what?

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Wed Jan 07, 2015 1:44 pm

maybe too much salt?

Code: Select all

//add to db	
	$db = helper::db();	
	$query = "INSERT INTO phpbb_users SET 
	user_id='$id', 
	group_id='2', 
	user_lang='nl',
	user_timezone='Europe/Amsterdam',	
	user_notify='1',
	user_style='1',
	user_form_salt='a7e0f2f19898c073',
	username='$name', 
	user_avatar='$avatar',
	user_avatar_width='150',
	user_avatar_height='150'";
	$db->query($query);	
	
	//add user to group	
	$query = "INSERT INTO phpbb_user_group SET 	
	group_id='2', 
	user_id='$id'";
	$db->query($query);	
I'm not sure what that user_form_salt does. Could that be the showstopper?

User avatar
John P
Registered User
Posts: 1237
Joined: Mon Jan 21, 2008 3:55 pm
Location: Netherlands
Name: John
Contact:

Re: user added in db is not seen on one adminpage, but not on the other?

Post by John P » Wed Jan 07, 2015 2:04 pm

Why not using the function user_add in functions.php?
Image
Webhosting, Custom MODs, Technical management, MOD installation and Webdesign

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: user added in db is not seen on one adminpage, but not on the other?

Post by RMcGirr83 » Wed Jan 07, 2015 3:26 pm

and the function group_user_add as well ;)

btw, the function is actually in the includes/functions_user.php file
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Thu Jan 08, 2015 1:59 pm

RMcGirr83 wrote:and the function group_user_add as well ;)

btw, the function is actually in the includes/functions_user.php file
thank you. But to use that function I seem to need to include the framework. Having trouble with that.

Code: Select all

define('IN_PHPBB', true);
	$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
	$phpEx = substr(strrchr(__FILE__, '.'), 1);	
	require_once(dirname(__FILE__).'/../common.php');
returns:

Code: Select all

Warning: require(./includes/startup.php): failed to open stream: No such file or directory in E:\_websites\phpbb\common.php on line 23

Warning: require(./includes/startup.php): failed to open stream: No such file or directory in E:\_websites\phpbb\common.php on line 23

Fatal error: require(): Failed opening required './includes/startup.php' (include_path='.;C:\php\pear') in E:\_websites\phpbb\common.php on line 23
I am used to JPATH_ROOT (Joomla).

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Thu Jan 08, 2015 2:01 pm

when I work around that with this:

Code: Select all

$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : dirname(__FILE__).'/../';
I get this error:
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/di/container_builder.php on line 292: file_put_contents([ROOT]/_import/../cache/container_[ROOT]/_importslashdotdotslash.php): failed to open stream: Invalid argument

nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 546
Joined: Sun Apr 13, 2014 1:47 am
Location: Grenoble - France

Re: user added in db is not seen on one adminpage, but not on the other?

Post by nicofuma » Thu Jan 08, 2015 2:19 pm

did you try $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../'; ?
Member of phpBB Development-Team
No Support via PM

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Fri Jan 09, 2015 7:35 am

YES!
Thank you.

This works:

Code: Select all

define('IN_PHPBB', true);
	$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';	
	$phpEx = substr(strrchr(__FILE__, '.'), 1);	
	require_once(dirname(__FILE__).'/../common.php');	
	require_once(dirname(__FILE__).'/../includes/functions_user.php');
	$user_row['username'] = $name;
	$user_row['group_id'] = '2';
	$user_row['user_email'] = 'noreply@nowhere73625.nl';
	$user_row['user_type'] = '0';	
	
	user_add($user_row);

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Fri Jan 09, 2015 8:03 am

RMcGirr83 wrote:and the function group_user_add as well ;)
no need to call that as the function user_add seems to deal with that as well. :D

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [solved]user added in db is not seen on one adminpage, but not on the other?

Post by RMcGirr83 » Fri Jan 09, 2015 9:20 am

It does if adding to the registered users group if you want to add to more groups then it is needed.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: [solved]user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Fri Jan 09, 2015 12:56 pm

thanks.

If I add an encrypted password in the db row for a user, I can login. But can not get a password reminder.

This is for a converter to copy data from our forum. We are administrators of this forumotion-based forum, so we don't have database access. I made a script so we can import the forums/topics/users (I will make this open-source on this forum when its all working and we're done). We can manualy copy-paste the emailadresses from the old to the new forum, but not the passwords. So I thought we would just email all users with a link to the
'I forgot my password' page, so each user can reset their password in the new forum.

The problem is that when I try as an imported user to get a password reminder I get this message:
The email/username information submitted could not be found.
So the user can login, but not get a password-reminder!?

What could I possibly be overlooking?

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: user added in db is not seen on one adminpage, but not on the other?

Post by RMcGirr83 » Fri Jan 09, 2015 3:26 pm

use eg

Code: Select all

global $phpbb_container;
// Instantiate passwords manager
$passwords_manager = $phpbb_container->get('passwords.manager');
then

Code: Select all

$passwords_manager->hash($foo['new_password'])
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

carsten88888
Registered User
Posts: 34
Joined: Tue Dec 30, 2014 7:22 am

Re: user added in db is not seen on one adminpage, but not on the other?

Post by carsten88888 » Mon Jan 12, 2015 1:28 pm

do you mean to generate a bogus password? Sorry I don't understand.

Post Reply

Return to “Extension Writers Discussion”