Link in event generated PM does not work

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
LuuLa
Registered User
Posts: 110
Joined: Thu Feb 19, 2004 4:25 pm

Link in event generated PM does not work

Post by LuuLa » Wed Oct 09, 2013 5:01 pm

Hi there,

by event, a PM is send to a user. In generally, that works fine with

Code: Select all

$subject = 'TEST';
$message = 'This is a [url=http://test.com]link[/url].';

$pmdata = array(
	'msg_id'			=> 0,
	'from_user_id'			=> $user->data['user_id'],
	'from_user_ip'			=> $user->ip,
	'from_username'			=> $user->data['username'],
	'reply_from_root_level'		=> 0,
	'reply_from_msg_id'		=> 0,
	'icon_id'			=> 0,
	'enable_sig'			=> 1,
	'enable_bbcode'			=> 1,
	'enable_smilies'		=> 1,
	'enable_urls'			=> 1,
	'bbcode_bitfield'		=> $bbcode_bitfield,
	'bbcode_uid'			=> 'abc123',
	'message'			=> $message,
	'attachment_data'		=> '',
	'filename_data'			=> '',
	'address_list' => array('u' => array($mod_id => 'to'))
);

include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
submit_pm('post', $subject, $pmdata);
But when the receiver opens his PM, he only gets the unformatted text:

Code: Select all

This is a [url=http://test.com]link[/url]
I think I have to use bbcode_second_pass() to get it work. But after two hours :( of testing, I get no results. Maybe, anyone has an idea what to do? Thank you in advance.

User avatar
LuuLa
Registered User
Posts: 110
Joined: Thu Feb 19, 2004 4:25 pm

Re: Link in event generated PM does not work

Post by LuuLa » Thu Oct 10, 2013 9:04 pm

Can anyone help me, please?

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: Link in event generated PM does not work

Post by EXreaction » Fri Oct 11, 2013 12:00 am

You'll want to use the generate_text_for_storage() function.

User avatar
LuuLa
Registered User
Posts: 110
Joined: Thu Feb 19, 2004 4:25 pm

Re: Link in event generated PM does not work

Post by LuuLa » Fri Oct 11, 2013 3:32 am

EXreaction wrote:You'll want to use the generate_text_for_storage() function.
That helped me. Thank you very much!

Code: Select all

		$uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
		generate_text_for_storage($message, $uid, $bitfield, $options, true, false, false);
		// PM stuff...

Locked

Return to “[3.0.x] MOD Writers Discussion”