An add-on to send automatically different PMs to user groups

You'll automatically gain access to this forum when you will post your first post in another forum. That way it will demonstrate how the Auto Group MOD works.
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

An add-on to send automatically different PMs to user groups

Postby Eiki on Sun 30. Oct, 2005 10:07

Hello Niels ! :D

Would it be possible to create a little add-on for Auto groups ?

The Auto-group MOD is really great ! Now, users from my forum will access more and more categories, and hidden forums as they send more and more posts ... really cool !

I would like to send automatically different PMs to each groups, when a user enter a group, to explain what is new (what is allowed) as they enter a new group with new permissions.

I would like to modify the content of each PM from the Admin Control Panel.

Would you be interested by creating such an add-on for your MOD ? Is it possible to create this ? :? Should I ask somewhere else ?

I hope you understand my post, I know I don't speak english very well ...

Thanks for reading anyway ! :wink:
Eiki
Poster
Poster
 
Posts: 5
Joined: Mon 24. Oct, 2005 15:23

Postby Niels on Thu 01. Dec, 2005 18:52

I get your point, the idea is good, I will consider change the mod slightly to allow this....

To get most easy around this, I have figured out this solution....
first you make a new forum - call it "Special PM forum" or similar.
This forum should be vieweble only to admin (and maybe mods)
inside this forum, you may make as meny topics you like (same as ususally)
The different would be that the topics it self is a "tempalte" for the special PM being sendt out once a user is added (or removed) from a autogroup (post count)

e.g. you could make a post like this

A special post wrote:Hello {USERNAME}
Congratulation on parse post count 200, you are now a member of the usergroup {USERGROUP}
This will give you further advangeges, and you may now edit you own messages inside the following forums X,Y,Z

best
The forum management
{POSTERNAME}


This post could e.g. have post id #1234
inside usergroup management, you would then have to fill in this post id in a new field called
Post id for special welcome PM:
also a new field called:
Post id for special removal PM:

once you fill e.g. the welcome field with the value 1234, all new users to this usergroup will recive a PM (only if added with autogroup)

does this sound like a useble solution...
should the user revice a PM email notification for sutch automated PM.... ?

This is only a idea to implement sutch feature, please give some feedback.
keep it simple is better, this makes it more likely that I have the time to implement...
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Thu 01. Dec, 2005 21:04

I have now tested this, it's working well.
here is a how-to for a beta version, please test and report back.

first you need to run this SQL
into your DB
Code: Select all
ALTER TABLE phpbb_groups ADD group_welcome_pm MEDIUMINT(8) NOT NULL ,group_remove_pm MEDIUMINT(8) NOT NULL

in file language/lang_english/lang_admin.php
Code: Select all
[FIND]
$lang['group_count_explain']

[AFTER ADD]
$lang['group_welcome_pm'] = "Specify a post ID to use as template for a welcome PM";
$lang['group_remove_pm'] = "Specify a post ID to use as template for a removal PM";


in file admin/admin_groups.php
Code: Select all
[FIND]
'L_GROUP_COUNT_DELETE' => $lang['Group_count_delete'],

[AFTER ADD]
'GROUP_WELCOME_PM' => $group_info['group_welcome_pm'],
'GROUP_REMOVE_PM' => $group_info['group_remove_pm'],
'L_GROUP_WELCOME_PM' => $lang['group_welcome_pm'],
'L_GROUP_REMOVE_PM' => $lang['group_remove_pm'],

[FIND]
$group_count_max = isset

[AFTER ADD]
$group_welcome_pm = isset($HTTP_POST_VARS['group_welcome_pm']) ? intval($HTTP_POST_VARS['group_welcome_pm']) : 0;
$group_remove_pm = isset($HTTP_POST_VARS['group_remove_pm']) ? intval($HTTP_POST_VARS['group_remove_pm']) : 0;

[FIND]
$sql = "UPDATE " . GROUPS_TABLE . "
SET group_type

[IN-LINE FIND]
, group_count_enable='$group_count_enable'

[IN-LINE AFTER ADD]
, group_welcome_pm='$group_welcome_pm', group_remove_pm='$group_remove_pm'

[FIND]
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_type,

[IN-LINE FIND]
,group_count_enable

[IN-LINE AFTER ADD]
, group_welcome_pm, group_remove_pm

[FIND]
VALUES ($group_type

[IN-LINE FIND]
,'$group_count_enable'

[IN-LINE AFTER ADD]
,'$group_welcome_pm','$group_remomve_pm'


in file templates/subsilver/admin/group_edit_body.tpl
Code: Select all
[FIND]
<br/>&nbsp;&nbsp; <input type="checkbox" name="group_count_delete" value="0"/>&nbsp;{L_GROUP_COUNT_DELETE}</span>
[AFTER ADD]
   <br/>
   <br/><input type="text" class="post" name="group_welcome_pm" maxlength="8" size="8" value="{GROUP_WELCOME_PM}" />&nbsp;&nbsp; {L_GROUP_WELCOME_PM}
   <br/><input type="text" class="post" name="group_remove_pm" maxlength="8" size="8" value="{GROUP_REMOVE_PM}" />&nbsp;&nbsp; {L_GROUP_REMOVE_PM}



in file functions_post.php
Code: Select all
[FIND]
$sign = ($mode == 'delete') ? '- 1' : '+ 1';

[BEFORE ADD]
global $userdata;

[FIND]
$sql = "SELECT ug.user_id, g.group_id

[IN-LINE FIND]
, g.group_count_max

[IN-LINE AFTER ADD]
, g.group_welcome_pm, g.group_name, g.group_remove_pm

[FIND]
$user_remove
[AFTER ADD]
      $replace_array = array (
         '{USERNAME}' => $userdata['username'],
         '{USERGROUP}' => $group_data['group_name'],
         '{POSTCOUNT}' => $group_data['group_count'],
         '{POSTCOUNT_MAX}' => $group_data['group_count_max']);

[FIND]
message_die(GENERAL_ERROR, 'Error insert users, group count', '', __LINE__, __FILE__, $sql);
}

[AFTER, ADD]
         // if a welcome PM is set, then copy the PM
         if ($group_data['group_welcome_pm']>0)
         {
            post_2_pm($group_data['group_welcome_pm'], $replace_array);
         }

[FIND]
message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);
}

[AFTER ADD]
         // if a remove PM is set, then copy the PM
         if ($group_data['group_remove_pm']>0)
         {
            post_2_pm($group_data['group_remove_pm'],$replace_array);
         }
Last edited by Niels on Fri 02. Dec, 2005 10:55, edited 1 time in total.
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Thu 01. Dec, 2005 21:14

once this is done (I hope I haven't forgot anything in this beta how-to)
You should as explained in my first post make a post somewhere - it really doesen't matter where, but for administrative reasoons it would be wise to make a dedicated forum for this...
you should be able to see this post, witch is the one I have made here on mods.db9.dk for testing this mod
http://mods.db9.dk/viewtopic.php?p=25870

as you can see the post id is 25870, this value is the post id filled inside the ACP group management.

you may alter any group inside ACP, once you look the group up, you will see 2 new feilds in the autogroup section
the first is the post id for the welcome PM, while the secound is the PM once a user is automatically removed from a usergroup.

if you look closer at the PM template (post id 25870) you will notice that this have some TAGS ({USERNAME}, {POSTERNAME} and so on, these will be replaced in the final PM to the user, giving the PM a litle more personal tutch.

these TAGS may be used inside the special PM templates.
{USERNAME} = the users own name
{POSTERNAME} = the name of the PM template poster
{USERGROUP} = the name of the usergroup
{GROUPCOUNT} = the number of post required to automatically being added
{GROUPCOUNT_MAX} = the # post before being removed again

best luck, and please report back
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Thu 01. Dec, 2005 21:18

This add-on will proberbly later be included into the mod (no reasoon not doing it)

How-ever I would like to have feedback about how it should work...
this pressent beta version will only sendt a PM to the user if the user self is increasing/decreasing the post count (making posts/delete posts)- e.g. if admin/mod removes some of the users posts, then the user will be removed from the usergroup (only if new postcount is matching the settings), the user will how-ever not be be notifyed with a "welcome/removal" PM - should this happen so or should the user also recive a PM in this case...

also if admin change postcount (max or min) in ACP group management - and check the boxes "add/delete new users" - what should happen ? should new users get the welcome PM, and should deleted users get the removed PM... this part is a litle difficult, since it will require some major changes in the autogroup files, so I prefere not.

btw. did I mentioned that the welcome/remove PM ofcouse support BBcodes, HTML, smilies just as if it was a ordenary PM
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Eiki on Wed 07. Dec, 2005 14:40

Hello Niels ! :D

First of all, I would like to thank you for this MOD, it's really great !
Please excuse me for not answering earlier, I was quite busy these days.

I will test this as soon as I can, to give you a feed-back of this beta version.

Sorry for my poor english, but I don't understand everything in your last post :oops: ... maybe I'll understand what you mean after installing this add-on ... :wink:
Eiki
Poster
Poster
 
Posts: 5
Joined: Mon 24. Oct, 2005 15:23

Postby Niels on Thu 08. Dec, 2005 00:27

my english is also poor, so might be my fault..its a litle difficult to explain.

basically what I was trying to say, is this:

the special welcome/removed PM will only be sendt out to the user if the postcount change is done via normal phpbb2 pages, if the postcount change is done via modcp.php (admin/moderator) and the post count change will add/remove the user from any usergroup. Then the user will not be notifyed by PM, only if the postcount change have been done via "posting.php"

by the way, you may try create a new account here on mods.db9.dk to see how it behaives, when making your first post (e.g. inside the test forum ) you will be added to the usergroup "poster" at same time you will recive a "welcome PM".
after this you may delete your test post - the result is you does not have any more post, and therefore automatically are removed from the usergroup "posters", at the time this happen, you will recive a "removed PM"
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Eiki on Thu 08. Dec, 2005 09:46

Ok thanks very much! Now I get what you meant, I will create a new account right away ... :wink:

And thanks again for all your work, it's really great !!! :D



edit : I just tested it and it works fine, 8) it's so cool ! Now I will try it mon my forum ... :wink:
Eiki
Poster
Poster
 
Posts: 5
Joined: Mon 24. Oct, 2005 15:23

Next

Return to Auto group [2.0.8/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron