News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Invitation System

Started by -Rock Lee-, February 24, 2020, 05:42:35 PM

Previous topic - Next topic

-Rock Lee-

Link to the mod

Invitation System
Invitation system to your forum | Version 1.4.1
Original Author: hadesflames

Introduction

The referral part adds a field to a user's profile that shows who invited that user. For other members to see this field, they need to have permission to do so, which can be granted to different member groups in the permissions section of the admin panel. Regardless of that permission, users will be able to see who invited them.

The gift is a unique feature that allows members to send their own gifts to other members of the forum. In order for a member to be able to gift their invites to other members, they need to have the appropriate permission, same as the referral permission. If you don't want to use this feature, simply don't give anyone the permission.

Language

Is available in:
  • English
  • Spanish Latin
  • Spanish Es
  • Turkish
  • Dutch ► Thank you @Rickpwns

Compatibility

Prepared to work with the branch 2.0.x of SMF, it is tested only with the default theme. Also you do not have to worry about damaging the source code of your installation because this modification uses hooks.
    +Now you are also ready to work with the 2.1.x branch.
   
License

This mod is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license. If you plan on distributing this mod in any way, there must be a link back to this page unless otherwise stated by a written agreement with the author. For full license details, visit this page:

https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode

or for a summary, visit this page, but take note of the disclaimer:

https://creativecommons.org/licenses/by-nc-sa/3.0/
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Shambles

Sounds fascinating.

Your screenshots seem to be in a foreign (well, to me anyway) language. Do you have any sample screenshots in English?

-Rock Lee-

Quote from: Shambles on February 24, 2020, 05:57:45 PM
Sounds fascinating.

Your screenshots seem to be in a foreign (well, to me anyway) language. Do you have any sample screenshots in English?

Oops, my mistake when uploading the images, I had others in Spanish but I attached some in English now I add them ;)


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

KittyGalore

Not really sure i understand what this mod actually does. So there are invitiation keys. What are they for it's mentioned giving them to other members but what does anyone do with them. Also i see a invitiation key is required on registration in the required section field how would anyone get a key is they have just stumbled on the forum and must enter it in the required section.
SMF Curve 2.0x

Shambles


KittyGalore

Quote from: Shambles on February 25, 2020, 01:23:04 PM
A description can be found in the original mod thread:

https://www.simplemachines.org/community/index.php?topic=391962.0
Thanks i kind of understand what it's about now. This was a new topic so i thought it was a completely new mod didn't realise the original existed.
SMF Curve 2.0x

Shambles

The original no longer exists but El Rock has redistributed it with a few changes - the original support thread remains, though :)

-Rock Lee-

Quote from: KittyGalore on February 25, 2020, 01:03:42 PM
Not really sure i understand what this mod actually does. So there are invitiation keys. What are they for it's mentioned giving them to other members but what does anyone do with them. Also i see a invitiation key is required on registration in the required section field how would anyone get a key is they have just stumbled on the forum and must enter it in the required section.

A kind of referral works where the administrator invites users and they may or may not invite acquaintances. Some Spanish speaking communities use it to do something smaller with people they know. I don't know if there is something so big in English speaking.


Regards!

Quote from: Shambles on February 25, 2020, 04:19:07 PM
The original no longer exists but El Rock has redistributed it with a few changes - the original support thread remains, though :)

I thought it was a great mod, it seemed strange that I missed it since there was no other for free, I simply organized the installer better and corrected some syntax to make it work with new versions. All the tests I did work well but if a problem arises I see if I solve it...


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

KittyGalore

Quote from: Rock Lee on February 25, 2020, 05:07:42 PM
Quote from: KittyGalore on February 25, 2020, 01:03:42 PM
Not really sure i understand what this mod actually does. So there are invitiation keys. What are they for it's mentioned giving them to other members but what does anyone do with them. Also i see a invitiation key is required on registration in the required section field how would anyone get a key is they have just stumbled on the forum and must enter it in the required section.

A kind of referral works where the administrator invites users and they may or may not invite acquaintances. Some Spanish speaking communities use it to do something smaller with people they know. I don't know if there is something so big in English speaking.


Regards!

Quote from: Shambles on February 25, 2020, 04:19:07 PM
The original no longer exists but El Rock has redistributed it with a few changes - the original support thread remains, though :)

I thought it was a great mod, it seemed strange that I missed it since there was no other for free, I simply organized the installer better and corrected some syntax to make it work with new versions. All the tests I did work well but if a problem arises I see if I solve it...


Regards!
Yes I understand now what it does like you said Spanish people use it more as I haven't encountered anything like this before. :)
SMF Curve 2.0x

Mike2021

Hi,
Thank you for sharing.
The installation worked well with version 2.1 RC2 but the invitation field does not appear in the registration form. The mod is activated and invitation keys have been generated.
What file should I modify to bring up the field?
----
Gracias por compartir.
La instalación funcionó bien con la versión 2.1 RC2, pero el campo de invitación no aparece en el formulario de registro. El mod está activado y se han generado claves de invitación.
¿Qué archivo debo modificar para que aparezca el campo?

Diego Andrés

Quote from: Mike2021 on February 26, 2020, 08:16:16 AM
Hi,
Thank you for sharing.
The installation worked well with version 2.1 RC2 but the invitation field does not appear in the registration form. The mod is activated and invitation keys have been generated.
What file should I modify to bring up the field?

The mod doesn't seem to be compatible with SMF 2.1

SMF Tricks - Free & Premium Responsive Themes for SMF.

-Rock Lee-

Quote from: Mike2021 on February 26, 2020, 08:16:16 AM
Hi,
Thank you for sharing.
The installation worked well with version 2.1 RC2 but the invitation field does not appear in the registration form. The mod is activated and invitation keys have been generated.
What file should I modify to bring up the field?

I only work with the 2.0 branch as a result of the type of license I am not insured if I can add functionality for 2.1 but investigate. If I cannot add this modification I will try to create something of 0 for branch 2.1.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Mike2021

Quote from: Rock Lee on February 26, 2020, 04:33:34 PM
Quote from: Mike2021 on February 26, 2020, 08:16:16 AM
Hi,
Thank you for sharing.
The installation worked well with version 2.1 RC2 but the invitation field does not appear in the registration form. The mod is activated and invitation keys have been generated.
What file should I modify to bring up the field?

I only work with the 2.0 branch as a result of the type of license I am not insured if I can add functionality for 2.1 but investigate. If I cannot add this modification I will try to create something of 0 for branch 2.1.


Regards!

Thank you for your response, it is nice of you to be interested in my request. I'll wait to hear from you.
Best Regards

grandseb59

hello rock lee

I would be interested in either an update of this mod if possible, or another equivalent mod running on version 2.1.1

thanks in advance

-Rock Lee-

@grandseb59 I don't think see anything similar, although I had planned to update it, I just didn't have time to try it. I'll see if I finish it this weekend and upload.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

grandseb59

@-Rock Lee- ok thank you
I will wait patiently for the beginning of next week to download your work on this mod.

-Rock Lee-

+Added Support for SMF 2.1.1
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

grandseb59


Rickpwns

Is there a way to make a translation for this mod? Would love to help the author and the community by adding a new language.

shadav

Quote from: Rickpwns on April 25, 2022, 01:42:38 PMIs there a way to make a translation for this mod? Would love to help the author and the community by adding a new language.
as with any mod or theme there should be language files
simply rename the files to your language and edit them accordingly

Rickpwns

#20
Quote from: shadav on April 25, 2022, 01:46:56 PM
Quote from: Rickpwns on April 25, 2022, 01:42:38 PMIs there a way to make a translation for this mod? Would love to help the author and the community by adding a new language.
as with any mod or theme there should be language files
simply rename the files to your language and edit them accordingly

Yes, after posting I decided to look around how it worked and found the language files. I added a Dutch translation file in the language folder and changed a few lines in 'package-info.xml' so the new file is imported after installing it.
It's working for me now. If anyone wants to do the same they can find the Dutch translation files in the attachment of my post. Download the .zip file for the complete installation or just download the .xml and .php file if you want to customize and add it to your own.

shadav

Quote from: Rickpwns on April 25, 2022, 02:35:40 PM
Quote from: shadav on April 25, 2022, 01:46:56 PM
Quote from: Rickpwns on April 25, 2022, 01:42:38 PMIs there a way to make a translation for this mod? Would love to help the author and the community by adding a new language.
as with any mod or theme there should be language files
simply rename the files to your language and edit them accordingly

Yes, after posting I decided to look around how it worked and found the language files. I added a Dutch translation file in the language folder and changed a few lines in 'package-info.xml' so the new file is imported after installing it.
It's working for me now. If anyone wants to do the same they can find the Dutch translation files in the attachment of my post. Download the .zip file for the complete installation or just download the .xml and .php file if you want to customize and add it to your own.
sorry but per most licenses I removed the attachment of the mod from your post....
typically uploading/redistributing of mods is not allowed per their licenses, all though after reading what rock lee stated in his initial post I'm unsure if he doesn't mind since the license does state as long as redistributing it links back to this thread...
that said :) thank you for the translation and I'm sure it will be added shortly to the original mod file

Rickpwns

Quote from: shadav on April 25, 2022, 02:47:17 PM
Quote from: Rickpwns on April 25, 2022, 02:35:40 PM
Quote from: shadav on April 25, 2022, 01:46:56 PM
Quote from: Rickpwns on April 25, 2022, 01:42:38 PMIs there a way to make a translation for this mod? Would love to help the author and the community by adding a new language.
as with any mod or theme there should be language files
simply rename the files to your language and edit them accordingly

Yes, after posting I decided to look around how it worked and found the language files. I added a Dutch translation file in the language folder and changed a few lines in 'package-info.xml' so the new file is imported after installing it.
It's working for me now. If anyone wants to do the same they can find the Dutch translation files in the attachment of my post. Download the .zip file for the complete installation or just download the .xml and .php file if you want to customize and add it to your own.
sorry but per most licenses I removed the attachment of the mod from your post....
typically uploading/redistributing of mods is not allowed per their licenses, all though after reading what rock lee stated in his initial post I'm unsure if he doesn't mind since the license does state as long as redistributing it links back to this thread...
that said :) thank you for the translation and I'm sure it will be added shortly to the original mod file
Oops, I'm sorry :) I was unaware of the license.
Hopefuly the language files that remain will help the people who are in need of the translation!

-Rock Lee-

@Rickpwns thanks for the translation, I'll see if I have time in the week and upload the updated package.

@shadav I am a bit of a sharing policy so that some contribution does not die, it can be useful although I also understand the issue here in SMF licenses are a bit strict. Even I sometimes have doubts about how to apply it, I'm not so used to it using in the right way (I suppose in my country they are somewhat softer and that is why it is difficult for me, but you learn as you go ;D).


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

-Rock Lee-

+Added dutch translations provided by @Rickpwns
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Ibues

Hello, @-Rock Lee-

I found a problem with the mod in SMF 2.1.2, you can read this here:

https://www.simplemachines.org/community/index.php?topic=583096.0

Thank you.

-Rock Lee-

+Profile view 2.1.x fix - Thank you @Ibues
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

eltee

#27
Hi, Thanks for this mod. I'd like to add a simple suggestion: allow passing the invite token in the registration url request, e.g., ?invite=xxxxxxxxxxxxxxxxxxxxxxxx and prefill the input. This way you can send the link to the user and spare them from having to cut and paste. I have an elderly user base and I need to make things as simple as possible.

In the meantime, could you point me to which file I should modify to do this myself. I know php but totally new to smf. Thanks

@-Rock Lee-

I'm getting this error whenever I try to click on Manage keys tab

Fatal error: Uncaught Error: Call to undefined function create_function() in [readcted]/smf/Sources/Invite.php:990 Stack trace: #0 [readcted]/smf/Sources/Invite.php(149): ManageKeys() #1 [readcted]/smf/Sources/Admin.php(499): invite_admin() #2 [readcted]/smf/index.php(191): AdminMain() #3 {main} thrown in [readcted]/smf/Sources/Invite.php on line 990

I'm using smf 2.1.2 php 8.1

-Rock Lee-

#28
I have to seesee if it can be applied it without so many problems, although it is not a bad idea to simplify the system a bit. Now regarding the error I did not test it with PHP 8.x but you may need to change the way you use the function because some things changed, I will take time this weekend to look at it and try solve it.


Regards!

Add: The file is in ../www/Sources/invite.php and it's not only line 990 but also line 336 because they both use the same variable.

Add 2: A quick search in the PHP manual is as I thought so, create_function is no longer used, at the moment I can only recommend using PHP 7.4 until I can figure it out.
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

eltee

Quote from: -Rock Lee- on September 20, 2022, 09:23:13 PMI have to seesee if it can be applied it without so many problems, although it is not a bad idea to simplify the system a bit. Now regarding the error I did not test it with PHP 8.x but you may need to change the way you use the function because some things changed, I will take time this weekend to look at it and try solve it.


Regards!

Add: The file is in ../www/Sources/invite.php and it's not only line 990 but also line 336 because they both use the same variable.

Add 2: A quick search in the hxxp:www.php.net/manual/en/function.create-function.php [nonactive] is as I thought so, create_function is no longer used, at the moment I can only recommend using PHP 7.4 until I can figure it out.

This seems to do the trick, but I don't know what I'm doing :)
                'data' => array(
                    'function' => function($rowData) {
                        global $txt;
                       
                        // Tell them the status of their page.
                        if ($rowData['active'])
                            return sprintf('<span style="color: green;">%1$s</span>', $txt['active']);
                        else
                            return sprintf('<span style="color: red;">%1$s</span>', $txt['nactive']);
                    },
                    'class' => 'windowbg',
                    'style' => 'text-align: center;',
                ),

Diego Andrés


SMF Tricks - Free & Premium Responsive Themes for SMF.

-Rock Lee-

Quote from: eltee on September 21, 2022, 07:30:52 PMThis seems to do the trick, but I don't know what I'm doing :)
                'data' => array(
                    'function' => function($rowData) {
                        global $txt;
                       
                        // Tell them the status of their page.
                        if ($rowData['active'])
                            return sprintf('<span style="color: green;">%1$s</span>', $txt['active']);
                        else
                            return sprintf('<span style="color: red;">%1$s</span>', $txt['nactive']);
                    },
                    'class' => 'windowbg',
                    'style' => 'text-align: center;',
                ),

It's perfect I'll do some tests later but it's what must be changed, also until the weekend I can't update the package O:).


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

eltee

this is really dumb but for the life of me I can't figure out how to send an invite, either from the front end or admin panel. I have "enable email invitation" checked. I am admin so should have permission. I've switched to php 7 in case that is an issue. what am I not seeing? thanks

-Rock Lee-

Quote from: eltee on September 22, 2022, 02:32:44 PMthis is really dumb but for the life of me I can't figure out how to send an invite, either from the front end or admin panel. I have "enable email invitation" checked. I am admin so should have permission. I've switched to php 7 in case that is an issue. what am I not seeing? thanks

Does the shipment appear in the mail queue? Doesn't it show you any error? You can enter "https://miwebsite/index.php?action=invite" ?


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

eltee

Quote from: -Rock Lee- on September 22, 2022, 11:30:45 PMDoes the shipment appear in the mail queue? Doesn't it show you any error? You can enter "https://miwebsite/index.php?action=invite" ?


Regards!

Ah, thank you. But where does that link appear? Because I do not see it anywhere on the web site or in the admin panel.

Btw, the invite email has the link as ?action=register when it should be ?action=signup  At least it is on my 2.1.2 install.

-Rock Lee-

Quote from: eltee on September 23, 2022, 12:12:16 AMAh, thank you. But where does that link appear? Because I do not see it anywhere on the web site or in the admin panel.

Btw, the invite email has the link as ?action=register when it should be ?action=signup  At least it is on my 2.1.2 install.

I'm sure I fixed this issue to add the menu where the keys are handled to the profile, I'm going to look at it, it may be that the hook does not load correctly.

The theme of the url as I have it for the 2.0.x and 2.1.x line was overlooked but that is edited in the same invite.php that I noted to change as well. Tomorrow I have my day off from work and I look at it more closely :).


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

-Rock Lee-

+Compatibility with PHP 8.x - Thank you @eltee
+Fix of the URL sent by mail
+Minor code fixes
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

eltee

Quote from: -Rock Lee- on September 25, 2022, 01:49:05 PM+Compatibility with PHP 8.x - Thank you @eltee
+Fix of the URL sent by mail
+Minor code fixes

thank you. the invite menu and gift link shows up for me now.

-Rock Lee-

Perfect any problem please report it :) , I will also see if in a next version I add some more things but I do not promise anything.



Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Dave J

Hi Rock Lee,

Is there any way that this mod can work in conjunction with the SMF default registration process so that someone who has not got an invitation code can still register as a member please?

At the moment no one passing a site can sign up to the forum unless they have a code.

Regards

Dave
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

Diego Andrés

Then why would they need an invitation?
Sounds like you could use the referral mod instead.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Dave J

#41
Quote from: Diego Andrés on September 30, 2022, 11:09:42 AMThen why would they need an invitation?
Sounds like you could use the referral mod instead.

The invitation mod makes it easy for existing members to invite friends and family to sign up.

I will look at the referral mod though, thanks for the pointer

Update: I found the referral mod and put it on my test site to have a look.
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

tobyp

I think I was using this mod in a forum I am administering (but didn't actually originally set up).

There was a package there called Invitation System v1.0.6, and in on of the menus there were options to create a new invite where I could add in a name and email address, and it would then email that person with a link to register.

I've had to upgrade the forum to run PHP 8.2, and that mod no longer says its compatible.  I downloaded the new version of Invitation System 1.4.3 which does appear to be compatible, but when I try to install it, I get an error:

Invalid default value for 'member_id'
File: /webroot/s/o/soa1org2uk/primary/www/sm/Packages/temp/install.php
Line: 78

I've looked, and that looks like it is creating a SQL statement to create a table for the invites - that table is already there because the old version installed it.

Is there a way I can get around this, and get back to the functionality I used to have.  I now have some options for formatting emails, and one for generating keys, but don't seem to have a menu option for sending an email.  Where should I be seeing the invite option?

Diego Andrés

You need to manually add a default value for the column, in this case it would be 0.

SMF Tricks - Free & Premium Responsive Themes for SMF.

tobyp

To do that, do I need to unzip the installation package, modify it and then rezip it?  I guess I can't change it in the unzipped file in the temp directory on the server?

Diego Andrés

You can do it directly on your database using phpmyadmin in the smf_invites table.
The other option is the one you propose, but you'd first need to fully uninstall the mod so that the table can be created again.

SMF Tricks - Free & Premium Responsive Themes for SMF.

-Rock Lee-

@tobyp This week I'm a bit complicated with my work, accounts payable :P, but I'm going to look at the package as soon as I can. Also something fast is the solution of Diego.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

BeberGold

After reading the complete thread and the mod description, a point is not clear.
I want to create a forum which is invite only. The following mod exists https://custom.simplemachines.org/index.php?mod=4251 . However, the description does not say if this mod adds the option to enable registrations "by invite only" with a code. Would somebody have the answer to my question please?
For clarity, I am talking about an "invite only" option on the registration configuration of the forum (https://wiki.simplemachines.org/smf/SMF2.0:Registration).
Would somebody know please?
Thank you.

Dave J

Quote from: BeberGold on June 26, 2023, 12:56:59 AMAfter reading the complete thread and the mod description, a point is not clear.
I want to create a forum which is invite only. The following mod exists https://custom.simplemachines.org/index.php?mod=4251 . However, the description does not say if this mod adds the option to enable registrations "by invite only" with a code. Would somebody have the answer to my question please?
For clarity, I am talking about an "invite only" option on the registration configuration of the forum (https://wiki.simplemachines.org/smf/SMF2.0:Registration).
Would somebody know please?
Thank you.

Hi BeberGold,

That mod adds another layer to the SMF registration process.

Once you have that mod installed people can't come along and register unless they have a code to input during the registration process, so therefore only people who are invited by you or your existing members can join, the site is in theory closed to everyone without a code.
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

BeberGold

Hi Dave, Thank you for the clarification. It is exactly what I want.

vicente127

Hello. I'm using this mod, but I was wondering if there's a way to block normal users to generate new invites and only receive them by 'X' days?

Advertisement: