https://www.icyphoenix.com/viewtopic.php?f=30&t=4545
-----------------------------------
Dragon
Fri 15 Aug, 2008 19:33

Welcome Personal Message (PM) - Define New Sender
-----------------------------------
Hello,

I have a litte problem with the welcome personal message (not email).
How can I edit the sender of it. By default it is the main site admin.
I tried to solve the problem by defining a new group leader of the admin group, but this didn't help for solving the problem.

It would last, if someone can tell me datebasetable and the entry of the user id to change. If there is a smarter way - its better :wink: 

thx for help.


-----------------------------------
Lopalong
Sat 16 Aug, 2008 09:42

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
I think you'll find that, that is language dependant. ;)

Open: lang_main_settings.php

Look for: $lang['register_pm']


-----------------------------------
Dragon
Tue 19 Aug, 2008 21:58

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
and how can i change the userid of the sender?


-----------------------------------
Lopalong
Wed 20 Aug, 2008 02:28

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
You can play with this in /includes/usercp_register.php ;)

[spoiler][code linenumbers=false]// START - SEND PM ON REGISTER MOD - AbelaJohnB
			//
			// According to 'netclectic' we need to set the datastamp to '9999999999' in order to
			// insure the pop-up notification about a new message existing. I concur with 'netclectic'
			// and have thus made the change to his suggestion. Thanks netclectic!
			//
			$sql = "UPDATE " . USERS_TABLE . "
				SET user_new_privmsg = '1', user_last_privmsg = '9999999999'
						WHERE user_id = $user_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			}

			$register_pm_subject = $lang['register_pm_subject'];
			$register_pm = $lang['register_pm'];
			$privmsgs_date = date('U');

			$main_admin_id = (intval($board_config['main_admin_id']) >= 2) ? $board_config['main_admin_id'] : '2';
			if ($main_admin_id != '2')
			{
				$sql = "SELECT user_id
					FROM " . USERS_TABLE . "
					WHERE user_id = '" . $main_admin_id . "'
					LIMIT 1";
				if (!($result = $db->sql_query($sql, false, 'main_admin_id_')))
				{
					message_die(GENERAL_ERROR, 'Couldn't obtain user id', '', __LINE__, __FILE__, $sql);
				}
				if ($row = $db->sql_fetchrow($result))
				{
					$main_admin_id = $row['user_id'];
					$db->sql_freeresult($result);
				}
				else
				{
					$main_admin_id = '2';
				}
			}

			$sql = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES ('0', '" . str_replace("'", "''", addslashes(sprintf($register_pm_subject, $board_config['sitename']))) . "', '" . $main_admin_id . "', " . $user_id . ", " . $privmsgs_date . ", '0', '1', '1', '0')";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert private message sent info', '', __LINE__, __FILE__, $sql);
			}

			$privmsg_sent_id = $db->sql_nextid();
			$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_text) VALUES ($privmsg_sent_id, '" . str_replace("'", "''", addslashes(sprintf($register_pm, $board_config['sitename'], $board_config['sitename']))) . "')";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert private message sent text', '', __LINE__, __FILE__, $sql);
			}
			// END - SEND PM ON REGISTER MOD - AbelaJohnB[/code][/spoiler]


-----------------------------------
Dragon
Wed 20 Aug, 2008 04:45

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
With this information i should be able to modify my board.

thank u all very mutch!  [img]http://www.icyphoenix.com/images/smiles/thx.gif[/img]


-----------------------------------
Lopalong
Wed 20 Aug, 2008 05:05

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
It would be nice of you to post your modifications for the "Admin Welcome PM changes", here in this thread when you have it all working. ;)


-----------------------------------
Dragon
Wed 20 Aug, 2008 16:06

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
It was not mutch work, I only had to modify the text in lang_main_settings.php how you allready said.

Then, to change the sender, there are two ways:

1. to change the main_admin_id in the ip_config table

2. or to directly insert it into that sql statement:

OPEN [b]/includes/usercp_register.php line 1199[/b]
FIND
[codeblock]$sql = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES ('0', '" . str_replace("'", "''", addslashes(sprintf($register_pm_subject, $board_config['sitename']))) . "', '" . $main_admin_id . "', " . $user_id . ", " . $privmsgs_date . ", '0', '1', '1', '0')";[/codeblock]
REPLACE WITH
[codeblock]$sql = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES ('0', '" . str_replace("'", "''", addslashes(sprintf($register_pm_subject, $board_config['sitename']))) . "', '" . 8 . "', " . $user_id . ", " . $privmsgs_date . ", '0', '1', '1', '0')";[/codeblock]

In this case the user with the id 8 is the sender.

That's it.


-----------------------------------
Lopalong
Wed 20 Aug, 2008 16:40

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
Thanks Dragon for "Your" effort, and for explaining it in the way that you have. 

Now anyone should be able to understand what you did, should they wish to apply those changes themselves. ;)

Moved to Documentation.


-----------------------------------
Mighty Gorgon
Thu 21 Aug, 2008 12:33

Re: Welcome Personal Message (PM) - Define New Sender
-----------------------------------
This SQL alter the main admin id:

[codeblock]UPDATE phpbb_config SET config_value = '2' WHERE config_name = 'main_admin_id';[/codeblock]

There is no way to change it via ACP because it's dangerous to allow other admins to change that value. :wink:


