Role Design

Syntax

There are two parallel types of members: artists and affiliates.

From a feature perspective, artists and affiliates are identical, yet they represent distinct groups of members presented distinctly.

We adopt the terminology that the term Member means Artist or Affiliate.
Saying Artist/Affiliate means either one
The names of the roles will be different, but they will have the same permissions.

The term User refers to a WordPress user.

Roles

We need to consider a few roles, besides the standard admin, editor, etc.

Initial Member (allows them the ability to create but not publish their member post)
Artist/Affiliate (allows the ability to publish their post)

The Initial Member role has only these capabilities:

upload_files
edit_published_posts
read ? (try without–see if it’s necessary)

The Artist & Affiliate roles have these capabilities:

upload_files
publish_posts
edit_published_posts
read ? (try without–see if it’s necessary)

Considerations

Install the Restrict Categories plugin so we can restrict access of artists.

https://wordpress.org/plugins/restrict-categories

Restrict artists from seeing the following categories:
Documentation
Footer
Homepage Feature
Main Nav
Tools

Each member gets their own page (really, a WP post).
It must get categorized as an Artist/Affiliate post
Member can upload content
Can only edit their page

To change the author attachments, use the plugin http://wordpress.org/extend/plugins/media-author/. the Author dropdown menu in Edit Media and Add Media from library screens.

A bigger framework for membership sites, with community and subscription models:

http://www.s2member.com/framework/

Workflow

The main requirement is that for each member:

Up front:
[ Create "Artist" and "Affiliate" post cateogries ]
[ Create Initial Member Role ]

Per User:
Create a new user
Assign to Initial Member Role (same as Member, but no publishing rights)
Need to create custom variables for artist info
[ Deploy tags for ethnicity, geography, media, etc. ]

Create a member post
Make the member the post author
Put post in “Artist” or “Affiliate” category

Notify admins of new member pages

Allow admin to publish member page via changing role from Initial Member to Artist or Affiliate

Give member publishing control of their page
(Limit access to certain post categories: Documentation, Footer, Homepage Feature, Main Nav, Tools)
Upload images
(Determine which fields to use for metadata)

Considerations for implementing membership features

How to change a user’s role?

$wp_user_object = new WP_User($current_user->ID);
$wp_user_object->set_role(‘editor’);

How to create a user?

http://codex.wordpress.org/Function_Reference/wp_insert_user

$userdata = array(
‘user_login’ => ‘login_name’,
‘user_url’ => $website);
$user_id = wp_insert_user( $userdata ) ;
//On success
if( !is_wp_error($user_id) ) { echo “User created : “. $user_id;}

The $userdata array can contain the following fields
Field Name Description Associated Filter
ID An integer that will be used for updating an existing user. (none)
user_pass A string that contains the plain text password for the user. pre_user_pass
user_login A string that contains the user’s username for logging in. pre_user_login
user_nicename A string that contains a URL-friendly name for the user. The default is the user’s username. pre_user_nicename
user_url A string containing the user’s URL for the user’s web site. pre_user_url
user_email A string containing the user’s email address. pre_user_email
display_name A string that will be shown on the site. Defaults to user’s username. It is likely that you will want to change this, for both appearance and security through obscurity (that is if you dont use and delete the default admin user). pre_user_display_name
nickname The user’s nickname, defaults to the user’s username. pre_user_nickname
first_name The user’s first name. pre_user_first_name
last_name The user’s last name. pre_user_last_name
description A string containing content about the user. pre_user_description
rich_editing A string for whether to enable the rich editor or not. False if not empty. (none)
user_registered The date the user registered. Format is Y-m-d H:i:s. (none)
role A string used to set the user’s role. (none)
jabber User’s Jabber account. (none)
aim User’s AOL IM account. (none)
yim User’s Yahoo IM account. (none)
When performing an update operation using wp_insert_user, user_pass should be the hashed password and not the plain text password.

Comments are closed.