MODX Community

Best practice for distributing different content to selected user (groups)?

I want to show different content (embedded videos in this case) to selected users or user-groups. Basically people can pay to get access to see different videos. Payment is not handled through the website, so users (or user-groups) have to be set manually.

Basically there are different videos and some users might have access to all and some only to individual ones. Ideally every user can login to a “Videos”-page where they get shown only the videos that they have been given access to.

So far I thought about managing this through user- and resource-groups and maybe showing the content using the Personalize Extra but that seems a little tedious to manage the users.

Another thought was to manage it from the video-side by creating a MIGX TV, where I can add the users through a MultiSelect to each individual video so it gets available to them. This option might be easier to manage as well for a client but I don’t know how I can make the output only show for the selected users.

My question therefore: What is a good method to achieve a system like this? What would be the preferred method and maybe are there any Extras out there to help with this?

I’d likely use the resource group + matching user group approach. A single user can be part of different user groups, so that way they can also get access to different videos/sections as needed.

Rather than manually assigning user groups though, I’d incorporate payment into the site and automate that. The User Group Shipment extension for Commerce for example can do that, and I’m sure there’s something similar to that for MiniShop as well.

If incorporating checkout into the site is not an option and the user panel is too complex, you could also consider creating a custom dashboard widget where a user and video (resource/resource group) can be selected which then adds it with the push of a single button. Clients tend to like dashboard widgets. :wink:

1 Like

Like almost everything in MODX, there are lots of ways to do this. If the different groups will see entirely separate resources, Mark’s idea is a good way to go.

If you need to show the same page to users but show different content to members of different user groups, you can use a custom snippet, but probably a better method would be to put the content in chunks, assign the chunks to categories (named after the user groups), and use Element Category ACL entries to control who sees what.

1 Like

Thank you so much for your inputs!

Another question that came up was, where would be the best place to locate the (video) files, so they are not accessible via the web? Would I use a regular directory in the root level and a .htaccess for this or does this interfere with MODX then as well?

You probably have to create static resources for your video files, so access to them can be restricted. You will have to create a new content type with the MIME type video/mp4 though, as such a type doesn’t exist by default.

Maybe, if the video files are big and there is much traffic, you may want to find a solution with an external video hosting platform.

Though, that would make uploading the videos not as straight forward as simply using the media browser I guess? I will have a look into this method.

Traffic is not really an issue, there won’t be a lot.

Rather than the static resource route, you could also place files in an inaccessible directory (somewhere in core/ or behind a htaccess block or outside the webroot entirely) and use the “FileDownload R” or “FileLister” extras to provide access through them via MODX. That way users can’t access it directly, only if they’re provided access through that.

Not sure how well that handles video - streaming might add complexities that those extras don’t handle. I’d probably consider Vimeo + locking down direct access/embeds other than on your own site if this doesn’t work out.

1 Like

I’d strongly recommend posting embedded video links vs links to the actual files. Most video services include the ability to do bandwidth and device detection so that users will be sent the appropriate stream. In addition, many user machines only support certain video formats/codecs so you don’t want to have to figure out what the user can accept.

2 Likes