Restrict access for profile type ...

Hello everyone,

I use elgg 1.7, and I have two questions about the profile plugin manager.

I want to restrict access to certain features of my site based on the profile, someone would have a bit of code to show me how I should proceed, for example I want to block access to the profile A for the Blog plugin, but profile B can use it.

My second question concerns the identification and always in relation to profile manager, I would like for a given profile, to block it in a view

For example Profile A have the default view, while the profile B have the view=profileb.
I placed this in the file action/login.php

forward ("pg / profile / {$ _SESSION ['user'] -> username}? view = {$ _SESSION ['user'] -> custom_profile_type}");

But he recovers the ID of the type of profile and not its name, it is also very easy for the user to change the url to change the view ...

Thank you in advance for any advice.


  • First of all...what you're looking to do is quite difficult. :)

    1) Setting restrictions for different kinds of objects would require some sort of mechanism to run a check on profile_manager metadata (profile type) and make a decision on what to do based on the result.

    2) You need to create a layout for profileb so that the system can find it and output the correct html. You've got the input in the forward (view=...) so that's a start. Now in the relevant page of the profile plugin (index.php) you need get that input and then set the $body accordingly.

    • You will need to revamp the profile plugin to deal with this. At the moment it uses a default elgg layout called "widgets", you would need to create a new layout for the profileb type.
    • The way you do this all depends on how different you want the appearance of the two profile type profiles to be.
  • Hello,

    thank you for your answer, it is the basis for discussion I have taken better worded, I have to turn this into code now, if someone want to show me a basic ...