By Paul Murray on Wednesday, 24 January 2018
Posted in General Issues
Replies 5
Likes 0
Views 585
Votes 0
Hello Stack Ideas

I am using Groups to display videos and let people answer questions.
I had a developer write a plugin so that when a users buys a product he gets invited into an ES Group.

The heart of this plugin was some code that Mark kindly posted:


$group = ES::group($groupId);

$group->createMember($user->id, true);


After development and testing of said Plugin this works perfectly.

The thing is that having purchased access to the group (essentially purchasing an invite) a user can then go and invite another user.

I know that this is a Private invite Group and that is a good thing.
It is just that I want to be able to control the invites via Hika Shop.
And not have users inviting other user to join.

Is there a way to prevent/block users from inviting other user to join a group.

Whilst NOT* breaking my plugin that essentially lets Hika Shop invite people to join a group after purchase.

If possible only for Groups in the Category "Study Groups"

https://finalbug.net/groups-learn-post-production-socially-fcpx-and-more/categories/11-studygroups/latest

thanks

Paul

*Apologies about the capitals but this is the mission critical part
Hi Paul,

You can try this code:

$group = ES::group($groupId);

$group->canInvite($user->id);
·
Wednesday, 24 January 2018 19:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Fadhli

Where do I add this code?

I tried the custom CSS file and did all that compile/refresh/compress stuff In the Vanilla template but this did not help.

I am guess need to add it some where else.

kindly advise

Paul
·
Wednesday, 24 January 2018 20:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Paul,

The code snippet which Fadhli provided earlier only determines if the user has access to invite other members. You need to write your own codes and utilize that code. I am sorry but unfortunately this is beyond the scope of our support and we would not be able to assist you with this.
·
Wednesday, 24 January 2018 21:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark

Of course I understand.

thanks all the same

Paul
·
Wednesday, 24 January 2018 21:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for understanding Paul!
·
Wednesday, 24 January 2018 22:26
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post