项目作者: hypeJunction

项目描述 :
Group and user invitations for Elgg
高级语言: PHP
项目地址: git://github.com/hypeJunction/hypeInvite.git
创建时间: 2016-09-29T12:32:17Z
项目社区:https://github.com/hypeJunction/hypeInvite

开源协议:

下载


Invitations for Elgg

Elgg 2.2

Features

  • Allows users to invite new users by email
  • An option to create an invite-only network
  • Keeps track of all invitations to the same email address
  • Creates friend requests when invitations are accepted
  • Group owners can allow members to invite other members
  • Site admins can allow group invitations of non-friends
  • Site admins can allow group invitations by email

Notes

  • Registration must be enabled on the site for this plugin to work
  • In an invite-only network, uservalidationbyemail will be bypassed,
    as it is assumed that users would have received their invitation code by email
  • When invited by email to group, non-existing users will first have to create an account. Upon registration,
    invitations will be created for every group the email has been invited to before registration.

Developer Notes

Creating Invites

Other plugins may centralize off-site invitations and attach custom behavior to the invites.
For example, to invite non-registered users to an event by their email:

  1. $invite = users_invite_create_user_invite($email);
  2. add_entity_relationship($invite->guid, 'invited_to', $event->guid);
  3. add_entity_relationship($invite->guid, 'invited_by', $inviter->guid);
  4. // generate a registration link to include in the notification
  5. $registration_link = users_invite_get_registration_link($email, $inviter->guid);
  6. // implement a custom handler
  7. elgg_register_plugin_hook_handler('accept', 'invite', function($hook, $type, $return, $params) {
  8. $invite = $params['invite'];
  9. $user = $params['user'];
  10. $events = elgg_get_entities_from_relationship([
  11. 'types' => 'object',
  12. 'subtypes' => 'event',
  13. 'relationship' => 'invited_to',
  14. 'relationship_guid' => $invite->guid,
  15. 'limit' => 0,
  16. ]);
  17. if (!$events) {
  18. return;
  19. }
  20. foreach ($events as $event) {
  21. add_entity_relationship($user->guid, 'attending', $event->guid);
  22. }
  23. });