1

Topic: Invitation 1.0.1

##        Mod title:  Invitations
##
##      Mod version:  1.0.1
##   Works on PunBB:  1.2.5
##     Release date:  2005-06-29
##           Author:  Tobi (tobi@tobi.gr)
##
##      Description:  Allows users to send invitations. The invitations come with a code 
##                    that allows to track if the invitation has been sent 
##                    and who has invited the new user.
##                    Administrators can give invitations to users that tey can send out
##
##   Affected files:  functions.php
##                    profile.php
##                    register.php
##
##       Affects DB:  Yes
##
##            Notes:  1. The install_mod routine currently works only for MySQL.
##                    2. Missing Administration interface to monitor sent invitations
##                    3. Fixed some issues that occur when installing over an alrready modded 
##                    Installation
##                    4. Corrected typo in lang/English/invitation.php
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##

There is also an admin plugin to get statistics for invitations and to issue invitations to use by your users.

Find it here

The German PunBB Site:
PunBB-forum.de

2

Re: Invitation 1.0.1

Great idea, I'm definitely going to test this one out smile

Re: Invitation 1.0.1

Installing it and making it the way I wanted was kind of frustrating, but anyway, thanks for the mod. Hopefully I can get more users to my forums with this.

Thanks again!
Brian

Looking for a certain modification for your forum? Please take a look here before posting.

4

Re: Invitation 1.0.1

pogenwurst wrote:

Installing it and making it the way I wanted was kind of frustrating

Yes I know, unfortunately it is not the easiest of all mods, lots of files involved..... glad you got it running.

The German PunBB Site:
PunBB-forum.de

Re: Invitation 1.0.1

I have two recommendations for if you ever make a new version:
- Have an option for all users to have unlimited invites
- Improve the invitation "card" that is sent

Looking for a certain modification for your forum? Please take a look here before posting.

6

Re: Invitation 1.0.1

Hi,
what kind of improvement do you have in mind?

As for the limitation:
In the administration you can give X invitations to any user.
X can well be a number above 1000000 smile

The German PunBB Site:
PunBB-forum.de

7 (edited by pogenwurst 2005-09-05 14:00)

Re: Invitation 1.0.1

Tobi wrote:

what kind of improvement do you have in mind?

There are a few issues:

- IMHO, the card is hard to edit. When I tried editing it myself, I went through a billion errors before I could get it right.
- The link tag is messed up - I see the HTML when I receive the invitation. Do you have to configure the MIME type as text/html or something? (I really don't know)
- The card should include some info on the board - title, admins, moderators, etc
- The admin plugin should have a field for a default header, footer, etc to send with each invite
- If you can get HTML working right, BBCode might be nice, though it wouldn't be that important

I guess that's kind of a hefty list, but it's just my opinion. Overall, the mod is great. I'd just hate to see it spoiled by a few minor issues. I made a few minor chages to your code; if you want, I can email them to you, though I don't think they'd be much use, they're just aesthetic (did I spell that right?) changes.

Also, when someone doesn't have any invitations left, a message should be displayed in the profile view, rather than just a blank pane. I'm not sure - do new members automatically receive invites based on the amount given to each group in the plugin? If not, they should.

OK, I'm done wining now smile. If you need some help testing, or with something that doesn't require much PHP skill, just ask.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Invitation 1.0.1

Also, you might want a way for members to preview invites before they send them, and to be able to send multiple invites at once. A filter that prevents sending invites to emails already registered and emails already invited might be nice too.

I'll *see* if I can implement any of these changes on my own, and email you the source, though I doubt my PHP skills are good enough.

Looking for a certain modification for your forum? Please take a look here before posting.

9

Re: Invitation 1.0.1

pogenwurst wrote:

There are a few issues:

pogenwurst wrote:

- IMHO, the card is hard to edit. When I tried editing it myself, I went through a billion errors before I could get it right.

Yes, you have to do that in the source.
I'll see if I can change that.

pogenwurst wrote:

- The link tag is messed up - I see the HTML when I receive the invitation. Do you have to configure the MIME type as text/html or something? (I really don't know)

No, you don't have to change the mime type. I thought some mail clients wouldn't interprete the link as a clickable one without the html tag but that was maybe wrong...
I'll fix that.

pogenwurst wrote:

- The card should include some info on the board - title, admins, moderators, etc

Hm. I think I'll add some description of the board so people know *what* they are invited to. You have a point there.
But I think the admin names are not so important

pogenwurst wrote:

- The admin plugin should have a field for a default header, footer, etc to send with each invite
- If you can get HTML working right, BBCode might be nice, though it wouldn't be that important

Sorry, I am very conservative in this and IMO emails have nothing, absolutely noting to do with HTML and they shouldn't. They are messages, information, whatever, and seeing the amount of mail traffic nowadays any tag that you do not send helps smile
So - no HTML mails for me, thanks.

pogenwurst wrote:

I guess that's kind of a hefty list, but it's just my opinion. Overall, the mod is great. I'd just hate to see it spoiled by a few minor issues. I made a few minor chages to your code; if you want, I can email them to you, though I don't think they'd be much use, they're just aesthetic (did I spell that right?) changes.

Yes, go ahead, I am absolutely sure it is not perfect. This thing is terribly bad to test (no esxcuse, just an explanation wink )

pogenwurst wrote:

Also, when someone doesn't have any invitations left, a message should be displayed in the profile view, rather than just a blank pane. I'm not sure - do new members automatically receive invites based on the amount given to each group in the plugin? If not, they should.

You are right there, however, this is difficult to implement.
I'll see for that when I find the time.

The German PunBB Site:
PunBB-forum.de

10

Re: Invitation 1.0.1

I added the following feature to the mod invitation:

- U can define now for each group how many invitation each user will get by default.
This amount is given out to every new user, and, on group change, will be added to his current amount.

As for the invitation text:
Since I want people to write their own text I didn't want to mess around with that. Maybe I'll make a default text sometime but that involves all those language files again.. sad

Have a look here, if it's OK I'll upload it to punres as well.

Mod Invitation 1.1

It's not a mod update, it's a new version. Hope you can figure out where the changes are.
The only tricky part is that it requires a new field in PREFIXgroups. That's defined in mod_install.php so maybe you can do it in phpMyAdmin.

The German PunBB Site:
PunBB-forum.de

Re: Invitation 1.0.1

tobi wrote:

Sorry, I am very conservative in this and IMO emails have nothing, absolutely noting to do with HTML and they shouldn't. They are messages, information, whatever, and seeing the amount of mail traffic nowadays any tag that you do not send helps smile
So - no HTML mails for me, thanks.

That's fine - your the one doing the work anyway. Like I said, the BBCode isn't that important to me.

Anyway, I'll see if I can install the new version and test it out for you. I'll post back with my results.

Also, I mentioned being able to preview a card before sending - I have a vague idea of how I might be able to hack that together on my own, though it'll probably be a week or two until I'm finsished 'cause I've got other stuff to attend to.

Thanks for your quick response! I'm glad to see your taking care of your mod.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Invitation 1.0.1

tobi wrote:

The only tricky part is that it requires a new field in PREFIXgroups. That's defined in mod_install.php so maybe you can do it in phpMyAdmin.

Is there some command I can run in the DB Management plugin? Sorry, but I have almost no knowledge of MySQL.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Invitation 1.0.1

i get this error

aftr going to invitation link to register form and typing the all the fileds and aftr submitting this error come

An error was encountered
Error: Unable to verify invitationNo data.

what to do now?

14

Re: Invitation 1.0.1

pogenwurst wrote:

Is there some command I can run in the DB Management plugin? Sorry, but I have almost no knowledge of MySQL.

AFAIK you cannot do that with the management plugin.

But for people who have no knowledge of MySQL (AND for people wh hate typing everything on the command line) there is phpMyAdmin. If you haven't got it yet you should get it today.
It lets you easily manage your database in the browser.
http://www.phpmyadmin.net/

The German PunBB Site:
PunBB-forum.de

15

Re: Invitation 1.0.1

mastiland wrote:

i get this error

aftr going to invitation link to register form and typing the all the fileds and aftr submitting this error come

An error was encountered
Error: Unable to verify invitationNo data.

what to do now?

So you clicked on the link in the invitation email you got and this error came up?
How did the link look?
The message means more or less that it was an invalid invitation id.

The German PunBB Site:
PunBB-forum.de

16 (edited by mastiland 2005-09-07 09:04)

Re: Invitation 1.0.1

no i clicked the link the registration form opened i typed all the stuff and then when i pressed submit i got that error

The Email Was Like This

to the board<a
href='http://www.mastiland.com/forum/register.php?invite=b7665435a8f224327fda0b1195d02a64'>http://www.mastiland.com/forum/register.php?invite=b7665435a8f224327fda0b1195d02a64</a>

U TRY REGISTRING AND SEE WAT HAPPENS IF U DIDNT GET ME.

17

Re: Invitation 1.0.1

OK I saw it.

This happens when the user who registers gives an email address that is different from the one the email was sent to.
Say, you send an invitation to masti@land.com .
Now the recipient clicks the link, goes to the registration page and in his email address field he enters
somebody@else.org

Then you get this failure.

Stupid of me to have this undocumented, but I think for security reasons it makes sense

If you hate this feature I'll tell you how to stop the email double check smile

The German PunBB Site:
PunBB-forum.de

Re: Invitation 1.0.1

ya plz tell how do i do that

or if possible can it be done that that the email address  directly gets entered in the field

plz giv me codes for both

thnks

19 (edited by Tobi 2005-09-07 11:17)

Re: Invitation 1.0.1

To take the email check out do the following:
In your include directory, open invitation_db.php and go to line 64

  $result = $db->query("SELECT userid from ".$db->prefix."invitations 
        WHERE recipient='" . $email . "' and code='" . $code . "' and used='00000000000000'") or error('Unable to fetch Invitation code', __FILE__, __LINE__, $db->error());

and replace it with

  $result = $db->query("SELECT userid from ".$db->prefix."invitations 
        WHERE code='" . $code . "' and used='00000000000000'") or error('Unable to fetch Invitation code', __FILE__, __LINE__, $db->error());

That's all.
As for the automatic filling, that's a lot more work.
try this first & see if it fixes your problem wink

The German PunBB Site:
PunBB-forum.de

20 (edited by mastiland 2005-09-07 11:43)

Re: Invitation 1.0.1

i think now it doesnt show if the invite has been used (even when it is used )

21 (edited by Tobi 2005-09-07 13:57)

Re: Invitation 1.0.1

Ohhhhh... sorry. Sorry. Sorry.
I overlooked something.
Easiest thing is you go to include/invitation_db.php and replace the complete function checkInvitation with:

function checkInvitation($email,$code)  {
  global $db;
  //Check if the given Emailis the same as the one used in the invitation
  $result = $db->query("SELECT userid from ".$db->prefix."invitations 
        WHERE code='" . $code . "' and used='00000000000000'") or error('Unable to fetch Invitation code', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result) or $db->num_rows($result) == 0)  {
       return "No data";
       }
    else  {
      list($userid) = $db->fetch_row($result);
      $result = $db->query("update  ".$db->prefix."invitations set used=NOW()
        where code='" . $code . "'") or error('Unable to update Invitation table', __FILE__, __LINE__, $db->error());
      return $userid;
      }
  
  }

I tested this and it does work.

The German PunBB Site:
PunBB-forum.de

22 (edited by mastiland 2005-09-08 05:15)

Re: Invitation 1.0.1

ok its working properly now

but the email sent always goes to junk mail

how do i change the email going

to the board<a
href='http://www.mastiland.com/forum/register.php?invite=b7665435a8f224327fda0b1195d02a64'>http://www.mastiland.com/forum/register.php?invite=b7665435a8f224327fda0b1195d02a64</a>

we could make the email look like this instead

'the message goes first' then comes you are invited to the 'forum title' by the 'username' so plz register out here and 'the link' (not the link with html codes only the link thats it

i am sure this wont go to junk.

or just tell where i can edit the email

23

Re: Invitation 1.0.1

You do that in include/mod_invitation.php
in line 29:

     $mtext = $form['invitation_text'] . "\n".$lang_invitation['Forum Link'].$act_link;

You can add, tweak, remove text here.
Have fun!

The German PunBB Site:
PunBB-forum.de

Re: Invitation 1.0.1

thnks man

25 (edited by mastiland 2005-09-08 20:15)

Re: Invitation 1.0.1

hey but hyperlink

<a href=""></a>

in the email it doesnt become hyperlink

it becomes

<a
href='http://www.mastiland.com/forum/register.php?invite=b7665435a8f224327fda0b1195d02a64'>http://www.mastiland.com/forum/register.php?invite=b7665435a8f224327fda0b1195d02a64</a>

what to do so it could be hyperlink in the email