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
327aaf3f
Commit
327aaf3f
authored
Dec 01, 2008
by
Nigel McNie
Browse files
[UPSTREAM] Remove the rather sadistic "No friends" message on users' profile pages
Instead, put controls in its place.
parent
77d1589a
Changes
5
Hide whitespace changes
Inline
Side-by-side
htdocs/blocktype/myfriends/lib.php
View file @
327aaf3f
...
...
@@ -49,6 +49,7 @@ class PluginBlocktypeMyfriends extends SystemBlocktype {
}
public
static
function
render_instance
(
BlockInstance
$instance
,
$editing
=
false
)
{
global
$USER
;
$userid
=
$instance
->
get_view
()
->
get
(
'owner'
);
$smarty
=
smarty_core
();
$records
=
get_records_sql_array
(
'SELECT usr1, usr2 FROM {usr_friend}
...
...
@@ -93,6 +94,46 @@ class PluginBlocktypeMyfriends extends SystemBlocktype {
}
$smarty
->
assign
(
'friends'
,
$friends
);
$smarty
->
assign
(
'friendsmessage'
,
$friendsmessage
);
// If the user has no friends, try and display something useful, such
// as a 'request friendship' button
$loggedinid
=
$USER
->
get
(
'id'
);
$is_friend
=
is_friend
(
$userid
,
$loggedinid
);
if
(
$is_friend
)
{
$relationship
=
'existingfriend'
;
}
else
if
(
record_exists
(
'usr_friend_request'
,
'requester'
,
$loggedinid
,
'owner'
,
$userid
))
{
$relationship
=
'requestedfriendship'
;
}
else
{
$relationship
=
'none'
;
$friendscontrol
=
get_account_preference
(
$userid
,
'friendscontrol'
);
if
(
$friendscontrol
==
'auto'
)
{
$newfriendform
=
pieform
(
array
(
'name'
=>
'myfriends_addfriend'
,
'successcallback'
=>
'addfriend_submit'
,
'autofocus'
=>
false
,
'renderer'
=>
'div'
,
'elements'
=>
array
(
'add'
=>
array
(
'type'
=>
'submit'
,
'value'
=>
get_string
(
'addtomyfriends'
,
'group'
)
),
'id'
=>
array
(
'type'
=>
'hidden'
,
'value'
=>
$userid
)
)
));
$smarty
->
assign
(
'newfriendform'
,
$newfriendform
);
}
$smarty
->
assign
(
'friendscontrol'
,
$friendscontrol
);
}
$smarty
->
assign
(
'relationship'
,
$relationship
);
$smarty
->
assign_by_ref
(
'USER'
,
$USER
);
$smarty
->
assign
(
'USERID'
,
$userid
);
return
$smarty
->
fetch
(
'blocktype:myfriends:myfriends.tpl'
);
}
...
...
htdocs/blocktype/myfriends/theme/default/myfriends.tpl
View file @
327aaf3f
...
...
@@ -15,6 +15,17 @@
{/
foreach
}
</table>
{
else
}
{
str
tag
=
'nofriends'
section
=
'group'
}
{
if
$USERID
==
$USER
->
get
(
'id'
)
}
<div
class=
"message"
>
Try
<a
href=
"
{
$WWWROOT
}
user/find.php"
>
searching for friends
</a>
!
</div>
{
else
}
{
if
$relationship
==
'none'
&&
$friendscontrol
==
'auto'
}
<div
class=
"message"
>
{
$newfriendform
}
</div>
{
elseif
$relationship
==
'none'
&&
$friendscontrol
==
'auth'
}
<div
class=
"message"
><a
href=
"
{
$WWWROOT
}
user/requestfriendship.php?id=
{
$USERID
}
&returnto=view"
class=
"btn-request"
>
{
str
tag
=
'requestfriendship'
section
=
'group'
}
</a></div>
{
elseif
$relationship
==
'requestedfriendship'
}
<div
class=
"message"
>
{
str
tag
=
friendshiprequested
section
=
group
}
</div>
{/
if
}
{* Case not covered here: friendscontrol disallows new users. The block will appear empty. *}
{/
if
}
{/
if
}
</div>
htdocs/lang/en.utf8/group.php
View file @
327aaf3f
...
...
@@ -244,7 +244,6 @@ $string['cantmessageuser'] = 'You cannot send this user a message';
$string
[
'requestedfriendship'
]
=
'requested friendship'
;
$string
[
'notinanygroups'
]
=
'Not in any groups'
;
$string
[
'numberoffriends'
]
=
'Friends (%s of %s)'
;
$string
[
'nofriends'
]
=
'No friends :('
;
$string
[
'addusertogroup'
]
=
'Add to '
;
$string
[
'inviteusertojoingroup'
]
=
'Invite to '
;
$string
[
'invitemembertogroup'
]
=
'Invite %s to join \'%s\''
;
...
...
htdocs/theme/default/static/style/style.css
View file @
327aaf3f
...
...
@@ -1214,10 +1214,15 @@ fieldset.collapsed legend a {
font-size
:
11px
;
}
#userview
.user-icon
input
#addfriend_add
{
input
#addfriend_add
,
input
#myfriends_addfriend_add
{
background
:
transparent
url(../images/icon-add.gif)
no-repeat
left
;
border
:
0
;
color
:
#7f9d16
;
color
:
#3092ce
;
margin
:
0
;
}
input
#myfriends_addfriend_add
{
font-weight
:
bold
;
}
#userview
.user-icon
#invite
,
#userview
.user-icon
#addmember
{
...
...
@@ -1241,7 +1246,7 @@ fieldset.collapsed legend a {
color
:
#7f9d16
;
height
:
16px
;
}
#userview
#
btn-request
{
.
btn-request
{
background
:
transparent
url(../images/icon-add.gif)
no-repeat
left
;
padding
:
4px
12px
;
}
...
...
htdocs/theme/default/templates/user/view.tpl
View file @
327aaf3f
...
...
@@ -18,7 +18,7 @@
{
$newfriendform
}
{
elseif
$relationship
==
'none'
&&
$friendscontrol
==
'auth'
}
<br>
<a
href=
"
{
$WWWROOT
}
user/requestfriendship.php?id=
{
$USERID
}
&returnto=view"
id
=
"btn-request"
>
{
str
tag
=
'requestfriendship'
section
=
'group'
}
</a>
<a
href=
"
{
$WWWROOT
}
user/requestfriendship.php?id=
{
$USERID
}
&returnto=view"
class
=
"btn-request"
>
{
str
tag
=
'requestfriendship'
section
=
'group'
}
</a>
{/
if
}
{
if
$invitedlist
}
<div>
{
str
tag
=
groupinvitesfrom
section
=
group
}{
$invitedlist
}
</div>
{/
if
}
{
if
$inviteform
}
...
...
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