/** * resend invite * * @param int $id * @param UserTable $user */ private function sendInvite( $id, $user ) { global $_CB_framework; $row = new InviteTable(); $row->load( (int) $id ); $returnUrl = $_CB_framework->pluginClassUrl( $this->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $row->get( 'group' ) ) ); if ( $row->get( 'id' ) ) { if ( ! CBGroupJive::canAccessGroup( $row->group(), $user ) ) { cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' ); } elseif ( $user->get( 'id' ) != $row->get( 'user_id' ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to send this invite.' ), 'error' ); } elseif ( ! CBGroupJive::isModerator( $user->get( 'id' ) ) ) { if ( ( $row->group()->get( 'published' ) == -1 ) || ( ( ! $this->params->get( 'groups_invites_display', 1 ) ) && ( $row->group()->get( 'type' ) != 3 ) ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to invites in this group.' ), 'error' ); } } } else { cbRedirect( $returnUrl, CBTxt::T( 'Invite does not exist.' ), 'error' ); } if ( ! $row->send() ) { cbRedirect( $returnUrl, CBTxt::T( 'GROUP_INVITE_FAILED_TO_SEND', 'Invite failed to send. Error: [error]', array( '[error]' => $row->getError() ) ), 'error' ); } cbRedirect( $returnUrl, CBTxt::T( 'Invite sent successfully!' ) ); }