Skip to content

Instantly share code, notes, and snippets.

@nathanielks
Created January 9, 2014 22:03
Show Gist options
  • Save nathanielks/8342908 to your computer and use it in GitHub Desktop.
Save nathanielks/8342908 to your computer and use it in GitHub Desktop.
// Okie doke. Need to process how to handle reciprocal connections, as well
// as determining when to add a user to blog as a certain type. For
// example, lets talk about students adding family friends as students.
// A student will invite another student as a family friend. It'll check to
// see if that user exists, if so, record their user id and email an
// invitation to that user. The user will then accept the invitation. On
// invitation acceptance, when it goes to add the student to the journal
// hosts journal, it'll check to see if the current user ( journal guest )
// is a student. If so, it'll also add the journal host to the journal
// guests' journal as well.
//
// How about the case of when a student invites a teacher? When a student
// invites a teacher, it'll check to see if the user exists. If so, it'll
// record the user id and email an invitation to the user. The user will
// then accept that invitation. On invitation acceptance, it'll check to
// see if the invitation guest ( current user ) is a student, and if so,
// it'll check it's user meta to see if it has any other students. Or,
// instead of only checking that user meta if the current user is
// a student, what about giving all teachers a user meta field of
// my_students, and record their id/email in that? Then, in case the user
// doesn't exist and they sign up, it'll pull that meta and replace their
// email with their new id. That'll also make student teachers much
// simpler... it'll just check to see if that meta field exists for that
// user and if it does then they're a teacher.
//
// So what about when the user doesn't exist and they need to be invited?
// In both cases, inviting a friend or inviting a student, it'll send an
// email to the invited user ( invitation guest ). The user will click the
// link in the email sent and proceed to the signup page with all their
// information pulled from the database. There should be a checkbox on
// their asking if they are a student, because otherwise it'll assign their
// primary user role as whatever they sign up as ( teacher or friend ). The
// only time it'll not ask if they're a student is if a teacher invites
// them as a student.
//
// At this point the user will complete signup and the connecting of the
// users will happen. Really, at this point, it'll just refer back to the
// two conditions I just described in the previous paragraphs... I don't
// think there'll be any different logic. The invitation and connecting of
// users should be handled by MAJ_Invitation, so signup will have to be
// rewritten a little bit.
//
// Also! Need to remember to change invitation status from pending to
// accepted!
//
// Side note: perhaps instead of giving a user a primary_user_role, maybe
// have the check be if they have a journal? Perhaps this could be an
// ancillary check... I think that'd be a bit more fluid in the context of
// everything else. Or maybe have their primary_user_role be a string of
// user roles they have... maj_student|maj_teacher|maj_friend, etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment