So, I have a small company, and I want the 'send a message' dropdown list to include all members, not just the friends of whoever happens to be sending the message. I'm pretty sure I'm going to have to change /mod/messages/views/default/messages/forms/message.php somehow, but I'm not sure about the script (I'm new to php). Can anyone help me out?
LJ
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Carlos@cloodo
Carlos - 0 likes
- longjohn@longjohn
longjohn - 0 likes
- mahmoudimus@mabdelkader
mahmoudimus - 0 likes
- longjohn@longjohn
longjohn - 0 likes
- SehLax@SehLax
SehLax - 0 likes
You must log in to post replies.LJ.. I sent you a message about that earlier today.
Yes, that's the file you need to change, particularly the (send_to) input.
-Carlos
I'm looking at the following code:
foreach($vars['friends'] as $friend){
//populate the send to box with a user's friends
echo "<option value='{$friend->guid}'>" . $friend->name . "</option>";
}
Somehow, I need to change the friend variable to a 'user' variable. Do I need to create that, or is there a built-in one I can use?
Hi Long John,
As you can see, the $friend is populated by iterating over an array that's passed in as $vars['friends']. The elgg framework usually populates the $vars associative array, so you would need to find out what is being passed in $vars['friends'].
Trace the code upwards and figure it out.
If it's a view, you will have to override the view.
FINALLY figured it out. Here's the solution (edit /mod/messages/views/default/messages/forms/message.php):
//make the first option blank
echo "<option value=''></option>";
//The following returns the 25 newest members; the number can be changed
$users = get_entities('user', '', 0, '', 25, 0, false, 0, null);
foreach($users as $user){
//populate the send to box with a user's friends the members of the site :)
echo "<option value='{$user->guid}'>" . $user->name . "</option>";
}
In case anyone stumples upon this like I did: I just made a simple Elgg 1.8 plugin out of these ideas. (the code above seems like for Elgg 1.7 (?)