I am building a portal where I always would like to show the weekly letter on top.
The standard mysite-view has this arranged but I would like to make sure that users who are registered does not move it around or remove it. Content with this "lock" applied should still be minimize and maximize-able but maybe that setting should not be saved, so whenever returning to their mysite the weekly-letter content is expanded by default.

This setting should only be set by a user with special permission, like admin.

What do you think is everything possible? Is anything stupid?

Comments

agentrickard’s picture

This is a perfectly reasonable request (it came up before http://drupal.org/node/135378) and is part of a next-gen feature set. See http://drupal.org/node/145423.

The easy way to do this right now is to hard-code the element that you want "locked" into the layout file(s) that your users can access. There should be obvious ways to do this if you read the API.

agentrickard’s picture

Version: 5.x-2.1 » master

Let's file this as a feature request against HEAD.

Question: would locked content count against a user's page element limit?

mounte’s picture

I think it should override the page-limit.

agentrickard’s picture

Assigned: Unassigned » agentrickard

OK, I've been thinking about this some more, and there are some complications.

1) Not all Layout files use the same regions, so how would we lock content across all Layouts? One answer is to only allow content locking in region 1 (typically the left-most region of the layout).

2) How may items can be locked?

3) What is the UI?

I'm not sure these questions are solvable. But here's what I did.

In HEAD, there is now a function mysite_display($type, $type_id, $uid = 0, $format = 'default') . It allows you to pull a MySite content element into another theme, block, or panel.

It may be that admins who want to lock site content need to hard code these calls into their layout files. I'll need to do some testing to see how that interacts with the drag-and-drop code.

For example, to add the data for term 2 to all user pages, so that it cannot be removed, call:

   print mysite_display('term', 2);
mounte’s picture

I have been overwhelmed with work for some time now, and it is not over yet.
Supposing that the admin has locked the layout to just one possible item I was thinking if it would be possible to create a "mysite-profile" which is a "default" profile with all content locked. When a user loads his mysite the "default" profile is loaded first, then the other content is added.

I have NOT been thinking so much about this, it might be totaly crazy ... what do you think?

agentrickard’s picture

That's basically how the 'default content' works now -- except that users can change the content after logging in.

The problem I see is how to handle that default 'locked' content across multiple layouts. If we have locked content in the right rail of a two column layout, where does it go for a user that has a single-column layout or a three-column layout selected?

One option I'm considering is making a 'hidden' layout region that can only be edited by the site administrator. This would be a 'region zero' that could be applied to all layout files.

Items within region zero could not be edited by the end user.

This might be a good compromise solution to the problem of flexible layouts.

agentrickard’s picture

Status: Active » Fixed

I have written a fix for this and documented it. From the README.

3.3  Locking Content for Users *

For MySite 5.x.2.5 and higher, the site administrator now has the option to
"lock" default page content.  Locking content forces the content element
to load for each MySite user; locked content loads in the position set by 
the site administrator.

To lock a content item, click on 'Default Page Content' and click the 
configure action button.  You should see a checkbox that asks if you 
would like to lock the content.  Check the box and submit the form to lock
the content item.

Note: This feature may have some odd behavior when the user changes
his or her content layout.  Since the user no longer has control over the 
position of locked content, there may be some user confusion.

Will commit to HEAD later today.

This feature requires that you run Drupal's update script.

Anonymous’s picture

Status: Fixed » Closed (fixed)