Skip to content
GitLab
Menu
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
0284a2da
Commit
0284a2da
authored
May 04, 2015
by
Son Nguyen
Committed by
Gerrit Code Review
May 04, 2015
Browse files
Merge "Bug 1432988: adjusting the required social profile field"
parents
530a10c5
d8eab8a0
Changes
2
Show whitespace changes
Inline
Side-by-side
htdocs/artefact/internal/lib.php
View file @
0284a2da
...
...
@@ -1172,28 +1172,17 @@ class ArtefactTypeSocialprofile extends ArtefactTypeProfileField {
*/
public
function
get_new_profile_elements
()
{
$socialnetworkoptions
=
array
();
foreach
(
ArtefactTypeSocialprofile
::
$socialnetworks
as
$socialnetwork
)
{
$socialnetworkoptions
[
$socialnetwork
]
=
get_string
(
$socialnetwork
.
'.input'
,
'artefact.internal'
);
}
$items
=
array
(
'socialprofile_service'
=>
array
(
'type'
=>
'text'
,
'title'
=>
get_string
(
'service'
,
'artefact.internal'
),
'description'
=>
get_string
(
'servicedesc'
,
'artefact.internal'
),
'defaultvalue'
=>
null
,
'size'
=>
20
,
'rules'
=>
array
(
'required'
=>
true
),
),
'socialprofile_profiletype'
=>
array
(
'type'
=>
'select'
,
'title'
=>
get_string
(
'profiletype'
,
'artefact.internal'
),
'description'
=>
get_string
(
'profiletypedesc'
,
'artefact.internal'
),
'options'
=>
array
(
'webpage'
=>
get_string
(
'webpage'
,
'artefact.internal'
),
'aim'
=>
get_string
(
'aim'
,
'artefact.internal'
),
'icq'
=>
get_string
(
'icq'
,
'artefact.internal'
),
'jabber'
=>
get_string
(
'jabber'
,
'artefact.internal'
),
'skype'
=>
get_string
(
'skype'
,
'artefact.internal'
),
'yahoo'
=>
get_string
(
'yahoo'
,
'artefact.internal'
),
),
'defaultvalue'
=>
'webpage'
,
'options'
=>
$socialnetworkoptions
,
'allowother'
=>
true
,
'width'
=>
171
,
'rules'
=>
array
(
'required'
=>
true
),
),
...
...
htdocs/lib/user.php
View file @
0284a2da
...
...
@@ -493,9 +493,8 @@ function plugin_account_prefs_submit(Pieform $form, $values) {
/**
* Save a profile field.
* Exception is 'socialprofile' field. It is made up of
3
fields:
* Exception is 'socialprofile' field. It is made up of
2
fields:
* socialprofile_profileurl,
* socialprofile_service,
* socialprofile_profiletype
* @param int $userid
* @param string $field
...
...
@@ -524,11 +523,19 @@ function set_profile_field($userid, $field, $value, $new = FALSE) {
$email
->
commit
();
}
else
if
(
$field
==
'socialprofile'
)
{
if
(
in_array
(
$value
[
'socialprofile_profiletype'
],
ArtefactTypeSocialprofile
::
$socialnetworks
))
{
$desc
=
get_string
(
$value
[
'socialprofile_profiletype'
],
'artefact.internal'
);
$type
=
$value
[
'socialprofile_profiletype'
];
}
else
{
$desc
=
$value
[
'socialprofile_profiletype'
];
$type
=
'website'
;
}
$classname
=
generate_artefact_class_name
(
$field
);
$profile
=
new
$classname
(
0
,
array
(
'owner'
=>
$userid
),
$new
);
$profile
->
set
(
'title'
,
$value
[
'socialprofile_profileurl'
]);
$profile
->
set
(
'description'
,
$
value
[
'socialprofile_service'
]
);
$profile
->
set
(
'note'
,
$
value
[
'socialprofile_profile
type
'
]
);
$profile
->
set
(
'description'
,
$
desc
);
$profile
->
set
(
'note'
,
$type
);
$profile
->
commit
();
}
else
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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