Skip to content
czheng edited this page Mar 18, 2012 · 1 revision

At the beginning of this month, Symphony's long-awaited Members extension was finally released, giving Symphony users at long last a powerful, standard tool for building front-end membership systems for their sites. The extension covers all the basics�member accounts and permissions, registration, authentication, and password recovery. But in typical Symphony fashion, it tries not to make too many assumptions and leaves more specific features up to you.

One such set of features is actually a fairly common requirement these days though, and chances are you've used something like it recently—��perhaps the last time you clicked a "Follow" button or voted something up, or clicked a link that said "I have this problem too." These kinds of functionalities each allow you, as a member of a website or a user of an application, to stake a unique claim on a particular piece or stream of content. I use this. This is important to me.

Developing such functionalities using Symphony's and Members' native tools is possible, but messy and unwieldy. And it needn't be. At root, this is a fundamentally simple problem. So I built a simple extension to solve it.

About Member Claims

Member Claims provides a set of basic tools for allowing members to manage their relationships with your content. Its goal is to make basic personalization straightforward and easy to implement in Symphony.

The extension is in beta and hasn't been tested all that thoroughly outside my own development.

Using Member Claims

Creating "Claimable" Content

The first thing you do to set up Member Claims (aside from installing it of course), is add a Member Claim field to one of your sections.

You can name it something like "followers" or "votes"�whatever's appropriate for your use case. There really aren't any field configuration options to speak of, because in the back end all the field does is show a count of claims.

Processing Claims

The next step is to enable members to actually claim this content on the front end. For that, the extension provides a custom event.

The event requires two fields to be submitted to it�entry-id and field-id�which it'll use to create a claim for the currently-logged-in member on the specified entry via the specified field.

The way I imagine this being used is that it'd be attached to a single front-end page and hit with AJAX post requests from any place on your site that requires member claims to be created or removed. You don't need to specify which though. Because claims are unique, the extension is able to determine whether it needs to create or remove a claim.

Outputting Claim Data

Once your content's being claimed, you'll want to be able to access that information in the context of the entry. For example, let's say you have a discussion thread entry and you want to display a count of followers along with an indication to the currently-logged-in member if s/he's following it.

The field provides two output modes: default and list. The default mode simply outputs an empty element with attributes for the claim count, the field id, and a flag for whether the currently-logged-in member is a claimant for the entry:

<followers count="13" field-id="43" current-member="Yes" />

The list mode takes this one step further and outputs the ids of all claimant members:

<followers count="3" field-id="43" current-member="Yes">
    <item>3</item>
    <item>6</item>
    <item>21</item>
</followers>

Leveraging Claim Data

Now let's say you want to use a Member Claim field to filter or sort output. Obvious use cases here are showing only entries that a member has claimed, or sorting entries by their claim count.

Right now, entries can be filtered on the Member Claim field by passing it a member id (usually that of the currently-logged-in member, i.e. {$member-id}). This would yield only the entries that the specified member has claimed.

Sorting on the Member Claim field will sort by the total number of claims, allowing you to create a list of the "most followed" or "most voted" content.

Moving Forward

As I said above, it's still early days for this extension. I'm developing it for a very specific use case (the new Symphony site) and I've not tested it thoroughly. So if you find this interesting, by all means please test it out.

And if I've missed any obvious features or use cases, just shout.