[BETA] Automated Random Welcome Post 0.0.2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

[BETA] Automated Random Welcome Post 0.0.2

Post by Joe Belmaati »

Code: Select all

##############################################################
## MOD Title: Automated Random Welcome Post
## MOD Author: Joe Belmaati < belmaati@gmail.com > (Joe Belmaati) N/A
## MOD Author: netclectic < adrian@netclectic.com > (Adrian Cockburn) N/A
## MOD Description: This MOD inserts an automated welcome post into an
## admin specified forum. The MOD makes use of language variables, so admin
## can customize the welcome messages easily. PHP will randomize the messages
## and pick one for each insterted welcome message. MOD is written so that
## it only inserts the welcome message if board user activation is set to
## "none". The forum that the welcome message is inserted into can be
## assigned from the ACP Board Configuration.
##
## MOD Version: BETA 0.0.2
##
## Installation Level: Easy
## Installation Time: 10 Minutes
## Files To Edit: (6)
##              admin/admin_board.php.php
##              includes/functions_selects.php
##              includes/usercp_register.php
##              language/lang_english/lang_admin.php
##              language/lang_english/lang_main.php
##              templates/subSilver/admin/board_config.tpl
##
## Included Files: (2)
##              includes/functions_welcome.php
##              db_update.php
##
## License: http://opensource.org/licenses/gpl-license.php GNU Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes: 99% of the credit for this MOD goes to netclectic
## who wrote the function which is the vehicle that drives this
## MOD.
##
## If you are going to run the SQL manually, then please
## remember to add your table prefix if other than phpbb_.
## For all intents and purposes it is probably easier to just run the
## db_update.php file. Upload it to your phpBB root directory
## and call it in your browser - then delete it.
##############################################################
## MOD History:
##
##   2005-08-03 - BETA 0.0.2
##      - filters out possible empty lang variables.
##
##   2005-08-02 - BETA 0.0.1
##      - initial BETA
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
I run a forum that is veeery easy going. Every time someone signs up I have tried to welcome them to the forum personally by adding a new post to the main forum on the site, along the lines of: "Welcome, Kermit. It's a pleasure to have you with us. Please feel free to join in the debate anytime - it's a friendly crowd". Other users on the board will chime in so that the new registrant will feel welcome right away. I have approximately 3-4 new registrations each week, so it's not too much of a burden. Then it struck me. Why not just automate the process? I'm always just writing nearly the same welcome message every time anyway (with a few variations here and there).

Enter Automated Random Welcome Post.

Synopsis

:arrow: This MOD will enter an automated welcome post into a forum of your choice, settable from the general ACP board config.

:arrow: The post will be entered as posted by the main admin.

:arrow: The post is personal in that it contains the new registrants username, and the post text itself is randomized shuffling through 10 messages that can be changed in the lang file. The post also contains the board signature.

:arrow: This MOD is coded up to only work for board that don't require user activation. It seems redundant to be welcoming someone that hasn't officially been approved yet.

:arrow: I have added 10 welcome messages to get you started. The language in these messages will no doubt be too lame for some forums. Change them to suit your own forum. Just try not to mess with the %s characters. They represent the places where the username and board signature will be insterted.

It is very important to note that the vehicle behind this MOD is function_insert_post(); written by neclectic.

Hope you find this MOD useful. Comments are welcome. For a demo, you can go here and register. Sorry about the inconvenience. It is just a test board that I use, and I don't see how else I can show the demo. The user accounts deleted from time to time as I scrap over everything and start over, so by signing up you will merely be testing the demo - nothing else. Again, sorry.

DOWNLOAD
Last edited by Joe Belmaati on Wed Aug 03, 2005 9:11 pm, edited 1 time in total.
Image

A.I. BOT
Registered User
Posts: 1848
Joined: Thu Apr 17, 2003 11:43 pm
Location: Newfoundland, Canada
Contact:

Post by A.I. BOT »

:O thats just what i wnated :) thanks

DKing
Registered User
Posts: 751
Joined: Sat Jul 03, 2004 8:38 pm

Post by DKing »

So basically, when a user registers, a post is posted in, say, a Welcome! forum? Can I make it say:
"Please take the time to greet {username}, who registered on {regdate}."?

That would be awesome!
-DKing
Latest phpBB Version: 2.0.21
Search For a MOD: MOD Search

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

Thank you very much for the nice words.
DKing wrote: So basically, when a user registers, a post is posted in, say, a Welcome! forum? Can I make it say:
"Please take the time to greet {username}, who registered on {regdate}."?

That would be awesome!
Very easy. Create a forum called Welcome Forum. Go to your ACP Board Config. Select "Welcome Forum" in the forum dropdown select welcome forum box.

Then

OPEN

includes/functions_welcome.php

FIND

Code: Select all

$message = sprintf($welcome[$rand_keys[0]], $username, $board_config['board_email_sig']);
REPLACE WITH

Code: Select all

$message = sprintf($lang['Welcome1'], $username, date('l, F jS, Y'), $board_config['board_email_sig']);
and OPEN

language/lang_english/lang_main.php

FIND

Code: Select all

$lang['Welcome1'] = 'Welcome %s. A sincere and warm welcome to our site. We hope that you will enjoy your stay with us.  %s';
REPLACE WITH

Code: Select all

$lang['Welcome1'] = 'Please take the time to greet %s, who registered on %s. %s';
This example does not randomize the message. It uses the same one everytime.

EXAMPLE
Image

User avatar
jh0nny
Registered User
Posts: 123
Joined: Thu Apr 01, 2004 1:53 am

Post by jh0nny »

Very nice idea!
But ... I would love to have the posts placed by another 'user' so not the head admin, is that easy to edit? 8)
:: Sex is just like software, it's better when it's free ::

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

jh0nny wrote: Very nice idea!
But ... I would love to have the posts placed by another 'user' so not the head admin, is that easy to edit? 8)


Extremely easy.

OPEN includes/functions_welcome.php

Change

Code: Select all

$poster_id = 2;
to the user_id of the person that the post will be placed by.
Image

User avatar
jh0nny
Registered User
Posts: 123
Joined: Thu Apr 01, 2004 1:53 am

Post by jh0nny »

Ok thanks, I had missed that part. :oops: 8)
I'm not sure if I have to ask this here but I might have an idea for a add-on, a gender-based system which gives another text for the female/males and a neutral one for the people who haven't choosen one.

Not sure if it is even possible. :lol:
:: Sex is just like software, it's better when it's free ::

»»EDDY««
Registered User
Posts: 220
Joined: Mon Jun 02, 2003 10:14 am
Location: Poland/Slupsk
Contact:

Post by »»EDDY«« »

Your file has name I-RATER.Web.Template.Pack-SoS.zip
LOL
Make a Tiny URL in excellent domain heh.pl


cooling system & water cooling

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

»»EDDY«« wrote: Your file has name I-RATER.Web.Template.Pack-SoS.zip
LOL
I'm sure that's important information. However, at this juncture I am not able to comprehend the semantics of that.

Oh, and MOD is updated to BETA 0.0.2.

I have added a small piece of code in includes/functions_welcome.php that deals with the contingency that people may want less than ten random messages and therefore delete some of the lang entries.
Image

countz
Registered User
Posts: 65
Joined: Fri Jul 09, 2004 7:07 pm

Post by countz »

Great Mod!


but i need help!
i want to insert in the message a link to the user profile, how to do this?


thanx in advance :)
This is a block of text that can be added to posts you make. There is a 800 character limit

http://www.bhq.it

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

OPEN functions_welcome.php

FIND

Code: Select all

$welcome = array_filter($welcome);
BEFORE, ADD

Code: Select all

$profile_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id") . '">' . $username . '</a>';
FIND

Code: Select all

$message = sprintf($welcome[$rand_keys[0]], $username, $board_config['board_email_sig']);
REPLACE WITH

Code: Select all

$message = sprintf($welcome[$rand_keys[0]], $username, $profile_link, $board_config['board_email_sig']);
FIND

Code: Select all

    $html_on = 0,
REPLACE WITH

Code: Select all

    $html_on = 1,
OPEN

language/lang_english/lang_main.php

FIND

Code: Select all

$lang['Welcome1'] = 'Welcome %s. A sincere and warm welcome to our site. We hope that you will enjoy your stay with us.  %s';
$lang['Welcome2'] = 'Welcome %s. It\'s a pleasure to have you with us. Feel free to join in anytime - it\'s a friendly crowd!.  %s';
$lang['Welcome3'] = 'Welcome %s. Great to have you with us. Please make yourself right at home.  %s';
$lang['Welcome4'] = 'Welcome %s. Thank you very much for signing up. We look forward to your participation. %s';
$lang['Welcome5'] = 'Welcome %s. Greetings from the management. And thank you very much for joining. We\'ll try to make it worth your while. %s';
$lang['Welcome6'] = 'Welcome %s. Hello and welcome to our site. Please feel free to let us know who you are and how you found us. %s';
$lang['Welcome7'] = 'Welcome %s. A warm and hearty welcome from all of us. Please join in the debate anytime.  %s';
$lang['Welcome8'] = 'Welcome %s. The air is good around here, and we are very happy to have you with us. %s';
$lang['Welcome9'] = 'Welcome %s. Great to have you joining our site. We look forward to hearing from you. %s';
$lang['Welcome10'] = 'Welcome %s. Bienvenue. Willkommen. %s';
REPLACE WITH

Code: Select all

$lang['Welcome1'] = 'Welcome %s. A sincere and warm welcome to our site. We hope that you will enjoy your stay with us.  Board members, please take a moment to look at %s\'s profile.  %s';
$lang['Welcome2'] = 'Welcome %s. A sincere and warm welcome to our site. We hope that you will enjoy your stay with us.  Board members, please take a moment to look at %s\'s profile.  %s';
That's the good news. The bad news is that since this welcome is entering your forum as message text you would need to enable html on your board and allow the a tag. Not sure if there's a workaround.. I have never tried to put variables into bbcode url's...
Image

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

OK, good news. It's not hard to post the link to the user without allowing html, so if you already applied the changes I gave you, then:

change $profile_link to:

Code: Select all

$profile_link = '[url=' . 'http://' . $board_config['server_name'] . $board_config['script_path'] . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id") . ']' . $username . '[/url]';
change $html_on back to

Code: Select all

$html_on = 0,
..hope that helps.
Image

countz
Registered User
Posts: 65
Joined: Fri Jul 09, 2004 7:07 pm

Post by countz »

thanx again!


it works perfectly
This is a block of text that can be added to posts you make. There is a 800 character limit

http://www.bhq.it

miels
Registered User
Posts: 5
Joined: Wed Jun 01, 2005 12:16 pm
Location: Eindhoven, Netherlands
Contact:

Post by miels »

My board is a bit too busy to add a post in a forum for every new user, so I'd like to just send a PB. In this message I'd like to welcome the user, and give a link to the post with rules on the forum etc.

I've been looking around for something like this in the forums, but i can't seem to find anything...

I think it wouldn't be to hard to change your mod so that it'll send a PB instead of a message to a forum. Unfortunately I don't know enough of php (nor phpBB) to do it myself.... :oops: So if you feel like adding a new feature, I'd really appreciate it!

gmex2006
Registered User
Posts: 463
Joined: Mon Jul 25, 2005 1:34 am

Post by gmex2006 »

Hmm I'm just testing your mod, Its really nice and quite reliable as well (no errors till now :wink: ).

Best of luck for your project(s) :D. Hope to see you around for a long time!!!!

Post Reply

Return to “[2.0.x] MODs in Development”