Disable users from posting on own Message Board

Hello everyone,

Please I need help on how the messageboard plugin can disable users from posting on their own message board.

 

i tried this

$owner = elgg_get_page_owner_entitiy();

if($owner) {

forward('activity');


} else {
$result = messageboard_add(elgg_get_logged_in_user_entity(), $owner, $message_content, $owner->access_id);
}

in messageboard/actions/add.php

but users are still able to post on their message board.

I just want to change the message board to make it look like feedback area for other users.

Please any help is much appreciated.

Thanks.

  • Ideally you shouldn't modify the plugin directly: http://docs.elgg.org/wiki/Dont_Modify_Core

     

    In a custom plugin you can hook into the action

    Check if the logged in user guid == $owner

    If so, register an error telling them why it can't be posted, and return false to stop the action from proceeding

  • Ok thanks, will try that

  • Maybe it would be better to not modify the action (or hook into the action) to prevent the profile page owner from making a posting (as it would be slightly annoying to write a posting and only after sending to realize that it won't get added) but to modify the widget content code to not display the add posting from in the first place to profile page owners:

    if (elgg_is_logged_in() && (elgg_get_page_owner_guid() != elgg_get_logged_in_user_guid())) {
        echo elgg_view_form('messageboard/add', array('name' => 'elgg-messageboard'));
    }

    Simply adding the modified content.php to your own custom plugin at mod/<your_plugin>/views/default/widgets/messageboard/content.php should override the core view (i.e. you would not need to modify a core file).

  • Yes thanks iionly, i took the code you sent me via pm and it worked.

    Thanks.

  • or a better idea would be able to comment directly on the message board below the original comment.