Skip to content

Commit

Permalink
Fix creating of demo content for forum collection
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Nov 28, 2016
1 parent e9f7888 commit 88bdb2a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions inc/collections/_demo_content.funcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ function assign_profile_picture( & $User, $login = NULL )
{
$File = new File( 'user', $User->ID, ( is_null( $login ) ? $User->login : $login ).'.jpg' );

if( ! $File->exists() )
{ // Don't assign if default user avatar doesn't exist on disk:
return;
}

// Load meta data AND MAKE SURE IT IS CREATED IN DB:
$File->load_meta( true );
$User->set( 'avatar_file_ID', $File->ID );
Expand Down Expand Up @@ -632,9 +637,13 @@ function get_demo_user( $login, $create = false, $group = NULL, $user_org_IDs =
default:
// do nothing here
}
$DB->query( "
INSERT INTO T_users__usersettings ( uset_user_ID, uset_name, uset_value )
VALUES ( ".$demo_user->ID.", 'created_fromIPv4', '".ip2int( '127.0.0.1' )."' ), ( ".$demo_user->ID.", 'user_domain', 'localhost' )" );

if( $demo_user && ! empty( $demo_user->ID ) )
{ // Insert default user settings:
$DB->query( 'INSERT INTO T_users__usersettings ( uset_user_ID, uset_name, uset_value )
VALUES ( '.$demo_user->ID.', "created_fromIPv4", '.$DB->quote( ip2int( '127.0.0.1' ) ).' ),
( '.$demo_user->ID.', "user_domain", "localhost" )' );
}
}

return $demo_user;
Expand Down

0 comments on commit 88bdb2a

Please sign in to comment.