PPL

The owner needs to be able to invite a new user from his profile page

Bug #708213 reported by Christopher Adams
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PPL
Fix Released
Critical
Brad Phillips

Bug Description

Each profile page should have an Invite button visible to the owner. This button will send a sign-up message to the user via email (and/or Twitter, etc.). The message will contain a verification link that points back to the sign-up page, where the user must choose a (unique) username and password.

The new user will not be able to edit the page or to import his or her own contacts.

Changed in ppl:
importance: Undecided → High
milestone: none → 0.2
Revision history for this message
rejon (rejon) wrote :

Might need more detail here on what htis looks like. The style should match the other design elements of the site.

Changed in ppl:
assignee: nobody → Brad Phillips (brad-bradphillips)
status: New → Confirmed
Revision history for this message
rejon (rejon) wrote :

Yes, please add info if this is too look specific christopher

Revision history for this message
Christopher Adams (christopheradams) wrote :

Pushing this back to 0.3.

For 0.2 the Owner will be able to publish the page, but PPL will not have the infrastructure to invite People or let them claim or own their page.

Changed in ppl:
milestone: 0.2 → 0.3
Revision history for this message
Christopher Adams (christopheradams) wrote :

Looking at how the system keeps track of who has been invited.

There are some fields in the aiki_users table that could be useful:

is_active
logins_number
first_login

Revision history for this message
Christopher Adams (christopheradams) wrote :

On the person Profile page, add a new User widget above the Services.

Check the number of logins for this user.

If the number is 0 display the following:

===
  » User

  [Invite Firstname Lastname to PPL]
===

Style the invitation as a button like "Tell a Story about..."

The invite button will link to [root]/people/create or whatever it should be.

If the number of logins is greater than zero, display the following:

===

  » User
  _______________

  ((username)) has logged in ((logins_number)) times.
  _______________

  The last login was at ((last_login)).
  _______________

===

Revision history for this message
Christopher Adams (christopheradams) wrote :

The [Invite] button will load a page with an a new form:

To: ((full_name))
Email: ((email)) //if this user does not have an email, the field is blank and the owner must enter one:
Message: I've created an account for you on http://people.ito.com. This is a site about all of the amazing people I have met and know around the world. Follow the link below to sign up and get started.

The message is also an editable text field that the Owner can customize.

Below the form is an [Invite] button. When the Owner clicks invite, the form inserts a rand_key into the aiki_users row for that user, and then sends an email with the Message text an a URL with that invite code.

When the user follows that URL, she will see basically what basically looks like the sign_up page. She has to choose a username and register for the site.

Changed in ppl:
importance: High → Critical
Changed in ppl:
assignee: Brad Phillips (brad-bradphillips) → Christopher Adams (christopheradams)
status: Confirmed → In Progress
Revision history for this message
Christopher Adams (christopheradams) wrote :

The message from the Owner at the bottom should have a signature:

 - [full_name]

(that is, the owner's full name)

Revision history for this message
Christopher Adams (christopheradams) wrote :

So the send_mail for that form should have:

[email]|OWNER NAME <OWNER EMAIL>|Welcome to people.ito.com.|<strong>Dear [full_name]:</strong>[message]

Revision history for this message
Christopher Adams (christopheradams) wrote :

Simplying things somewhat for the first go.

/users/invite/((userid)) simply displays a form with the users email address. Submitting the form will have an on_submit event that sends the email. The form will also add or update the email address if there wasn't one to begin with!

Changed in ppl:
assignee: Christopher Adams (christopheradams) → Brad Phillips (brad-bradphillips)
Revision history for this message
Brad Phillips (brad-bradphillips) wrote :

Ok, so I've been able to get this to work, but it's still in early stages & buggy.

So, the 'invite user' link on a contacts profile page now links to a widget I created called "invite_user_test". In this widget, I've inserted an add form (37) that adds a new record to the newly created ppl_invites table. It currently records the recipient_id, the sender_id, the e-mail to send to, a random key, and a message. When you load the page, you can add a message & an e-mail address & the invitation is successfully sent to the supplied e-mail, along with a link to accept the invitation.

I've also created another widget called invite_accept that displays on the url that is sent to the user's e-mail. Once the user clicks on the link & is taken to this page, an edit form will display (32) that will allow the user accepting the invite to change the username & password fields for the user who has the supplied invite_key attached to the end of the url.

I've been able to successfully change my contact's usernames & passwords using this method. The biggest issue, currently, is that I'm unable to log in with specified users after updating their information (it gives me a 'wrong username or password' error). I've confirmed that the fields are being updated in the db, so this error shouldn't be happening. The only thing that I think could be causing this error is that the user permissions for contacts is set to '5' & their is no permission group with that level, so it might be conflicting there.

Revision history for this message
Christopher Adams (christopheradams) wrote :

A few issues;

* The key is exposed in the URL. This means that the Owner could in theory manually construct the invite URL and impersonate the user. Is there any way to avoid this?

* The email on the invite page should be pre-filled.

* I would drop ignore the message field for now. Just used the canned message.

* After submitting the message just redirect back to the dashboard: on_submit:redirect:/dashboard

* There is some CSS we use for all the forms which you can copy from create_user or some other widget.

Revision history for this message
Brad Phillips (brad-bradphillips) wrote :

Ok, I've been able to tackle all of the notes except one & the css

* The random key is now generated by the aiki form & not passed along via the url.
* The message is now also generated by the form (the message field is ignored, for now).
* The form redirects to the /dashboard, when the invite is sent

Currently, form 41 should store a sender's e-mail address via the field: 'sender_email', but my attempts to automatically pull in the sender's email have proven unsuccessful, thusfar.

*I've tried variations on the following code & have either ended up storing nothing or breaking the form altogether:
**sender_email|SystemGOD:sender email:value:(sql((SELECT email FROM aiki_users WHERE userid = [userid]||[-[email]-]))sql)

Is there anything incorrect with the above code? This is the last remaining bit of functionality required to check this off of the list. Does anyone see anything wrong with the above code?

Revision history for this message
Brad Phillips (brad-bradphillips) wrote :

Ok, I was able to get the sender email to be auto inserted by adding the signed in user's userid to the invite link.

For some reason, I've only been able to dynamically insert data from another table, if I'm comparing a field to a url value (i.e. value: (sql((select email from aiki_users where userid = (!(3)!))||[-[email]-]))sql) ).

Attempts to do the same thing using global variables (i.e. value:(sql((select email from aiki_users where userid = [userid]||[-[email]-]))sql) ) or other fields in the form (i.e. value:(sql((select email from aiki_users where userid = [sender_id]||[-[email]-]))sql) ) proved unsuccessful.

I've filed a bug in aiki's launchpad reporting these issues, but currently, everything is functioning as expected & this bug is squashed!

Changed in ppl:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.