Guys, the button for reply messages doenst work and i don't change de code. Whats the problem?
mod/messages/pages/messages/read.php
<?php
/**
* Read a message page
*
* @package ElggMessages
*/
gatekeeper();
$message = get_entity(get_input('guid'));
if (!$message || !elgg_instanceof($message, "object", "messages")) {
//forward('messages/inbox/' . elgg_get_logged_in_user_entity()->username);
forward('messages/inbox/');
}
// mark the message as read
$message->readYet = true;
elgg_set_page_owner_guid($message->getOwnerGUID());
$page_owner = elgg_get_page_owner_entity();
$title = $message->title;
$inbox = false;
if ($page_owner->getGUID() == $message->toId) {
$inbox = true;
elgg_push_breadcrumb(elgg_echo('messages:inbox'), 'messages/inbox/' . $page_owner->username);
} else {
elgg_push_breadcrumb(elgg_echo('messages:sent'), 'messages/sent/' . $page_owner->username);
}
elgg_push_breadcrumb($title);
$content = elgg_view_entity($message, array('full_view' => true));
if ($inbox) {
$form_params = array(
'id' => 'messages-reply-form',
'class' => 'hidden mtl',
'action' => 'action/messages/send',
);
$body_params = array('message' => $message);
$content .= elgg_view_form('messages/reply', $form_params, $body_params);
$from_user = get_user($message->fromId);
if ((elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) && $from_user) {
elgg_register_menu_item('title', array(
'name' => 'reply',
'href' => '#messages-reply-form',
'text' => elgg_echo('reply'),
'link_class' => 'elgg-button elgg-button-action',
'rel' => 'toggle',
));
}
}
$body = elgg_view_layout('content', array(
'content' => $content,
'title' => $title,
'filter' => '',
));
echo elgg_view_page($title, $body);
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.
- graham@Graham13
graham - 0 likes
- Marcelo de Andrade@marceloandrade0201
Marcelo de Andrade - 0 likes
- rjcalifornia@rjcalifornia
rjcalifornia - 0 likes
- Marcelo de Andrade@marceloandrade0201
Marcelo de Andrade - 0 likes
- iionly@iionly
iionly - 0 likes
- Marcelo de Andrade@marceloandrade0201
Marcelo de Andrade - 0 likes
- rjcalifornia@rjcalifornia
rjcalifornia - 0 likes
- Marcelo de Andrade@marceloandrade0201
Marcelo de Andrade - 0 likes
You must log in to post replies.I have looked through your code and i am not an expert, but i can only see one change from your code to the original. That is your code reads 'text' => elgg_echo('reply'), and the origanal reads 'text' => elgg_echo('messages:answer'),
This might not be the solution but i find its always best to go back to the start when something brakes / goes wrong, if you change this and it works then that was your problem as the rest of the code is fine. If not this is the origanal code that works for me and maybe you have changed your css to move or hide this button somehow???? ...........
<?php
/**
* Read a message page
*
* @package ElggMessages
*/
gatekeeper();
$message = get_entity(get_input('guid'));
if (!$message || !elgg_instanceof($message, "object", "messages")) {
forward('messages/inbox/' . elgg_get_logged_in_user_entity()->username);
}
// mark the message as read
$message->readYet = true;
elgg_set_page_owner_guid($message->getOwnerGUID());
$page_owner = elgg_get_page_owner_entity();
$title = $message->title;
$inbox = false;
if ($page_owner->getGUID() == $message->toId) {
$inbox = true;
elgg_push_breadcrumb(elgg_echo('messages:inbox'), 'messages/inbox/' . $page_owner->username);
} else {
elgg_push_breadcrumb(elgg_echo('messages:sent'), 'messages/sent/' . $page_owner->username);
}
elgg_push_breadcrumb($title);
$content = elgg_view_entity($message, array('full_view' => true));
if ($inbox) {
$form_params = array(
'id' => 'messages-reply-form',
'class' => 'hidden mtl',
'action' => 'action/messages/send',
);
$body_params = array('message' => $message);
$content .= elgg_view_form('messages/reply', $form_params, $body_params);
$from_user = get_user($message->fromId);
if ((elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) && $from_user) {
elgg_register_menu_item('title', array(
'name' => 'reply',
'href' => '#messages-reply-form',
'text' => elgg_echo('messages:answer'),
'link_class' => 'elgg-button elgg-button-action',
'rel' => 'toggle',
));
}
}
$body = elgg_view_layout('content', array(
'content' => $content,
'title' => $title,
'filter' => '',
));
echo elgg_view_page($title, $body);
Thanks for help, graham.
also not solved the problem with modification in elgg_echo but i change the code and worked bellow:
First of all, you should not modify core files.
What is exactly that you want to accomplish? What's your elgg version? What's not working?
Hi, rjcalifornia!
I know...
I did absolutely nothing, only the reply button is not being displayed.
Elgg version 1.8
Did the problem "suddenly" occur (after really don't make any changes) or has it started after installing some plugin? Though I'm not sure if another plugin is causing the issue if you got it working by changing the menu item registering part within the code (as another plugin causing the issue would rather result in any changes within the messages plugin code having no effect anymore).
I've notived a second difference in your read.php compared to an unmodified read.php of Elgg core:
The forward line that is commented out is the original line while the second line is different. Have you changed it (being able to access messages of other users...)? What happens if you restore the original line? Maybe it works then again with displaying the reply button with the original elgg_register_menu_item code...
Ah! Sorry for that line, iionly. I remove that line and restore the elgg default :
forward('messages/inbox/' . elgg_get_logged_in_user_entity()->username);
i try both
@Marcelo
Before this issue, did you modify any other file? Did you install a new plugin?
@rjcalifornia
The problem is solved when the plugin i created was disabled.
Thanks a lot!