[buddypress-trac] [BuddyPress Trac] #6210: Create New Invitations API

buddypress-trac noreply at wordpress.org
Wed Mar 13 22:14:12 UTC 2019


#6210: Create New Invitations API
-----------------------------------------+-----------------------
 Reporter:  dcavins                      |       Owner:  dcavins
     Type:  enhancement                  |      Status:  reopened
 Priority:  low                          |   Milestone:
Component:  Core                         |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  dev-feedback trac-tidy-2018  |
-----------------------------------------+-----------------------

Comment (by dcavins):

 I'm attaching a new patch, that makes the following changes to the
 previous patch:

 • Rename logic classes and invitation object class:
   - `BP_Invitation` is the invitation object
   - `BP_Invitation_Manager` is the base logic class
   - `BP_Groups_Invitation_Manager` is the extension for group invitations.

 • Mark the base class and the methods within it, `run_send_action()` and
 `run_acceptance_action()`, `abstract`. You gotta bring your own business
 logic if you wanna play.

 • Remove `component_name` and `component_action` fields. I'm using the
 (sanitized) name of the extension class in place of this previous
 identifier, which I think makes sense. For example, a group invitation is
 stored like this:
 id: 9
 user_id: 3
 inviter_id: 1
 invitee_email:
 class: bp_groups_invitation_manager
 item_id: 8
 secondary_item_id: 0
 type: invite
 content: We would love it if you would join our group!
 date_modified: 2019-03-13 21:37:44
 invite_sent: 1
 accepted: 0

 Let me know if that's a bad idea for some reason. It seems simple to me,
 and also implies that that field will be unique per extension class,
 because a duplicated class would throw an error for php reasons. Of
 course, if you change the name of your extension class, the invitations in
 the database will be left disconnected. (The same would be true if you
 changed the `component_name` property with the earlier patch.)

 • Break the accept/reject membership request links and acceptance logic,
 which previously keyed on the `membership_id` of the request, using query
 arguments instead of `bp_action_variable` positions. New links look like:
 http://bptest.local/groups/group-six/admin/membership-
 requests/?_wpnonce=f8b7e7a866&user_id=2&action=accept

 • Update tests, adding a test invitation extension (now that the base
 class is abstract).

 Thanks in advance for your feedback!

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6210#comment:28>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list