Changing default wall filter

Hi guys,

I would really appreciate your help and insight. I finished building a small community site with elgg, but I'm really missing one thing, and don't know what to do: Change the default filter while you are on /activity/ page. The default is Show All, I want it to switch to Show Wall Posts, ie. I want the users to see just the posts, not profile pic changes, friends etc. Is it possible to do it somewhere from settings, or it needs plugin? Because honestly, I don't feel like programming anything more complex than simple hello world :D

 

Thank you for help!

  • You would need to create a little plugin to alter the filter. The plugin would only need to consist of a start.php stub (i.e. the start.php file needs to exist for Elgg to accept the plugin but the content of start.php only needs to be <?php in the first line), then you need a manifest.xml (just take one from another plugin and modify name and id fields and if you want the other fields). Then you need to override the core view vendor/elgg/elgg/views/default/resources/river.php (that's the only real file necessary in your file). So, create a copy of river.php in your plugin at mod/YOUR_PLUGIN/views/default/resources/river.php. Within your river.php you need to customize the lines

    $type = preg_replace('[\W]', '', get_input('type', 'all'));
    $subtype = preg_replace('[\W]', '', get_input('subtype', ''));

    according to your liking. You would just need to change the fallback values. For example, if only blogs should show up, the lines would be

    $type = preg_replace('[\W]', '', get_input('type', 'object'));
    $subtype = preg_replace('[\W]', '', get_input('subtype', 'blog'));

    or if you want any object related entries only

    $type = preg_replace('[\W]', '', get_input('type', 'object'));
    $subtype = preg_replace('[\W]', '', get_input('subtype', ''));

    So, you can define the default filtering by changing these lines but let the users still select other filter options from the dropdown. You just need to figure out what type and subtype the objects you want to display have (of course only one fallback combination possible).

    If you don't want your users being able to select any filter options at all, just comment out the line

    $content = elgg_view('core/river/filter', array('selector' => $selector));
  • Oh you are the best! Thanks a lot mate!

  • If I could ask you just one more question - I would like to set all new registered users to be banned, before they are evaluated, and eventually unbanned to be let into the community. So for that, I would go at creating a plugin that modifies a file, which pushes data into the DB, right? And just change the banned from no to yes. I tried setting the default value of the row banned to yes in mysql, however it doesn't work, so it has to be pushed somewhere by elgg. My question is - do you know where the hell I could find this file? I saw all registration.php and such, but I really don't understand from where they call the functions to push the data inside DB. I even tried looking at the user validation by email plugin, however this one doesn't show the registered users in the administration. Thanks for your help in advance!

  • I would have said that the uservalidationbyemail plugin already does some user validation. But as you mentioned it, you most likely want some other kind of user check.

    You can try the uservalidationbyadmin plugin (https://elgg.org/plugins/875414). As far as I know this plugin has been developed based on the code of the uservalidationbyemail plugin with the major difference that it only activates users by admin approval. So, maybe that's already what you are looking for. Otherwise, it might give you some starting points to find a solution by looking at the code.

  • thanks for the input, already sorted it out with a help from my coder friend :) 

  • I have now tried to figure out that how about if I example want blogs and groups and posts to show but not others like profile picture changes? Or is there then another way to approach this thing by removing something rather than this way? I'm using hypeWall also and already got rid of "likes".

  • but not others like profile picture changes

    Try https://elgg.org/plugins/873270

  • With just "throw" that did not work and not removed nothing I saw but I will check tomorrow how that works. Looks promising tho. Thank from that..