Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
871baf39
Commit
871baf39
authored
Aug 27, 2008
by
Richard Mansfield
Browse files
Copy views for new users and users joining institutions
parent
a05043e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/institution.php
View file @
871baf39
...
...
@@ -259,6 +259,8 @@ class Institution {
}
insert_record
(
'usr_institution'
,
$userinst
);
delete_records
(
'usr_institution_request'
,
'usr'
,
$userinst
->
usr
,
'institution'
,
$this
->
name
);
// Copy institution views to the user's portfolio
copy_views_for_user
(
$user
->
id
,
get_column
(
'view'
,
'id'
,
'institution'
,
$this
->
name
,
'copynewuser'
,
1
));
activity_occurred
(
'maharamessage'
,
$message
);
handle_event
(
'updateuser'
,
$userinst
->
usr
);
db_commit
();
...
...
htdocs/lib/user.php
View file @
871baf39
...
...
@@ -1126,9 +1126,34 @@ function create_user($user, $profile=array(), $institution=null, $remoteauth=nul
));
}
// Copy site views to the new user's profile
copy_views_for_user
(
$user
->
id
,
get_column
(
'view'
,
'id'
,
'institution'
,
'mahara'
,
'copynewuser'
,
1
));
handle_event
(
'createuser'
,
$user
);
db_commit
();
return
$user
->
id
;
}
function
copy_views_for_user
(
$userid
,
$templateids
)
{
if
(
!
$templateids
)
{
return
;
}
require_once
(
get_config
(
'libroot'
)
.
'view.php'
);
foreach
(
$templateids
as
$tid
)
{
$template
=
new
View
(
$tid
);
$v
=
new
View
(
0
,
(
object
)
array
(
'template'
=>
0
,
'numcolumns'
=>
3
,
'owner'
=>
$userid
,
'title'
=>
$template
->
get
(
'title'
),
'description'
=>
$template
->
get
(
'description'
),
));
$v
->
commit
();
$v
->
copy_contents
(
$template
);
$v
->
commit
();
}
}
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment