Change access level ACCESS_LOGGED_IN to specific group

I want to move all content of an exist elgg instance that has access_id ACCESS_LOGGED_IN to a specific group, since a second type of users will be entering the site.

So I need to move the content first and then change the access_id

Does anyone has an sql script available for doing this ?

 

  • Yep, if you want to make everything private to the group at the same time what Juho posted is the right query ^

  • Thanks, works great. Even found out how to switch it back

  • I think it's not yet everything necessary mentioned:

    What's with annotations (comments, likes and possible others) and river entries (both for the entitities and their annotations)? These database entries have also access_id columns you might also want to update to correspond with the new access_id of the entities.

  • Actually it was never even mentioned that the entities need to be private for the group, but I assumed this from the "...and then change the access_id".

    @iionly Yes, that is correct. Those also need to be updated. This is why it ElggBatch might have been an easier solution. It would trigger an update for those tables automatically.

  • Are you making these as simple scripts or are you creating a plugin? There would actually be a generic use in Elgg 1.9 for a plugin that would change the access_id of all the content inside a group. 1.9 will have the option of making a group visible only to it's members. By default it however affects only new content. Would be good to have a plugin that would convert all the previously public group content as hidden.

    So I'd recommend creating two different plugins: One that moves content into a group, and a second that would manipulate the access_ids of existing group content.

    (And the same as always: it's easier to help if you upload your work to Github)

  • I did only test this on a instance with little content. But if you change the access_id all entries in the river are not visible anymore to regular users. I am not sure about anotations on the moved content. I have to test that.

    As to making it into a plugin. Currently, it does not seem to be a generic enough for to me to create a separated  plugin just to do this. Maybe Coldtrick can extend their group tools, it seems like a nice enhancement there.

  • Annotations and metadata have independent access_ids (I thought the river did as well...) that should be updated in this process.  This is definitely why an ElggBatch would have been better.

  • In Elgg 1.8 river items have their own individual access_ids but in Elgg 1.9 we always check the access_id of both object_guid and target_guid.

  • Annotations are not visible anymore either, because you need group access. But I see the need to do this the right way and therefore changing access_id of river items and annotations.

  • I am looking into ElggBatch and I do find it usefull and actually changed some of my code to reduce memory print (like showing all activities from all groups where a user is member off in one tab.).

    But for the case at hand I do not see any benefit, since it seems I still need to select annotations and river items in separated batches, before changing access_id.

    Or am I missing something ?