Pointers to help me create plugin for below use case

Hi,

I am WordPress developer but using Elgg for one of my project. I have certain customization to make and considering creating plugin for them so that other Community members can use. I am listing one of the Use case below and any help in this regard will be appreciated.

1. The requirement is I do not want members to select access levels for Pages and Blogs. The Site default access level is public and is should be that only. For example on New Page or Post we can see word "Who can see it" and then drop down with access levels.

2. Similarly on Pages there is drop down who can modify it. I want it to be Private only. So that only admin can delete or modify the content not other users.

I tried this too and unset the access levels but it does not work as intended and impacts both of above user cases. Any help is appreciated as it will be given back to Community

elgg_register_plugin_hook_handler("access:collections:write", "all", "udinra_access_write_hook", 9999);
 
  • Which your Elgg version?

  • Thanks for fast response. I am using 3.1.1 the latest stable version

  • 1.

    In first, you can try to disable option for allowing users to set their own suggested privacy setting;

    Administration -> Site settings (Content module)

    Also, you can use the hook in your custom plugin.

    start.php

    elgg_register_plugin_hook_handler('view_vars', 'input/access', 'disable_access_levels', 999);
    
    function disable_access_levels(\Elgg\Hook $hook) {
        $return = $hook->getValue();
        $return['disabled'] = true;
        return $return;
    }

    2.

    Use this hook in your custom plugin (start.php):

    elgg_unregister_plugin_hook_handler('view_vars', 'input/access', 'pages_write_access_vars');
    elgg_register_plugin_hook_handler('view_vars', 'input/access', 'disable_pages_write_access', 999);
    
    function disable_pages_write_access(\Elgg\Hook $hook) {
        $return = $hook->getValue();
        $return['value'] = ACCESS_PRIVATE;
        
        return $return;
    }

    Learn more about views.

    Read this trick also.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking