Send PMs from outside of phpBB

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
JustChise
Registered User
Posts: 73
Joined: Thu Oct 30, 2014 4:56 am

Send PMs from outside of phpBB

Post by JustChise » Thu Feb 15, 2018 10:56 pm

Hello. I have a site where we run games and post registration threads in the forum. What I would like to be able to do, tho, is send PMs to all users that have participated in the past using a php script that exists separately from the phpBB software itself. So I'm just wondering if someone can point me towards the bare minimum I need to extract or replicate from the functions_privmsgs.php? Basically I want to automate the sending of these PMs to specific users and make sure they both get an email as well as a notification with the idea that if they haven't visited the forum recently, they'd at least see the email notification for the PM. Thanks.

Support Request Template
What version of phpBB are you using? phpBB 3.2.2
What is your board's URL? http://www.stablewars.com/forum
Who do you host your board with? Go Daddy
How did you install your board? I used the automatic download package from phpBB.com
What is the most recent action performed on your board? Update from a previous version of phpBB3.2
Is registration required to reproduce this issue? N/A
Do you have any MODs installed? No
What version of phpBB3 did you update from? N/A
What styles do you currently have installed? prosilver and a few others
What language(s) is your board currently using? English
Which database type/version are you using? MySQL 5
What is your level of experience? Not new to phpBB nor PHP
What username can be used to view this issue? No answer given
What password can be used to view this issue? No answer given
When did your problem begin? Not really a problem but a general question.
Please describe your problem. See description of question above...
Generated by SRT Generator

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 1972
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Send PMs from outside of phpBB

Post by kinerity » Thu Feb 15, 2018 11:21 pm

From includes\ucp\ucp_pm_compose.php. Obviously this will need to be adjusted accordingly. You would need to include the functions_privmsgs.php file.

Code: Select all

			$pm_data = array(
				'msg_id'				=> (int) $msg_id,
				'from_user_id'			=> $user->data['user_id'],
				'from_user_ip'			=> $user->ip,
				'from_username'			=> $user->data['username'],
				'reply_from_root_level'	=> (isset($post['root_level'])) ? (int) $post['root_level'] : 0,
				'reply_from_msg_id'		=> (int) $msg_id,
				'icon_id'				=> (int) $icon_id,
				'enable_sig'			=> (bool) $enable_sig,
				'enable_bbcode'			=> (bool) $enable_bbcode,
				'enable_smilies'		=> (bool) $enable_smilies,
				'enable_urls'			=> (bool) $enable_urls,
				'bbcode_bitfield'		=> $message_parser->bbcode_bitfield,
				'bbcode_uid'			=> $message_parser->bbcode_uid,
				'message'				=> $message_parser->message,
				'attachment_data'		=> $message_parser->attachment_data,
				'filename_data'			=> $message_parser->filename_data,
				'address_list'			=> $address_list
			);

			$msg_id = submit_pm($action, $subject, $pm_data);
Kailey Truscott - Community Team

JustChise
Registered User
Posts: 73
Joined: Thu Oct 30, 2014 4:56 am

Re: Send PMs from outside of phpBB

Post by JustChise » Thu Feb 15, 2018 11:28 pm

Thanks kinerity. I will give it a shot tomorrow but it looks pretty straight forward.

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 4 guests