Jump to content

Confused


ngreenwood6

Recommended Posts

I am pretty good with php but I am lost trying to figure something out. I am trying to edit a text file. The file has something like this in it:

 

Hello {USERNAME},

 

No where in this file is <?php. I am used to doing echo $username but this just seems odd to me. How does it get this username? I was thinking that it was calling this file from somewhere but I tried searching through all the source files of my site for that txt files name and came up with nothing. Any help is appreciated.

Link to comment
Share on other sites

Well I am using phpbb and there are nothing but text files in this specific folder. They are the emails and messages that you receive. Basically I am trying to make it so that when the person receives an email it sends them what was posted in the email, because right now it is just showing the link to the post. I am in the language folder so its not in the template. Any ideas?

Link to comment
Share on other sites

Well you don't need to find the render for that. Just set a template variable in the PHP and slap it into the template. :D

 

Just a note - there are many places where phpBB set template variables. Make sure you choose the right place or it won't work. I've had numerous issues when I was getting around phpBB3 for the first time. :D Good times...

Link to comment
Share on other sites

No when an email is sent you only get a link to the forums. I want it to show the person who replied to my message and show what they posted in the email that is sent. Right now it just gives a link to the forum topic so that you can click it and view the topic.

Link to comment
Share on other sites

You'll have to find the correct PHP page that sets the template variables for the template the sends that specific email. And you would just call it with "{SOME_NAME}" where SOME_NAME is defined as a template variable. The { } around it just lets the template system know that is has to do something with it.

Link to comment
Share on other sites

Not sure it's just a str_replace() because the template vars are stored in an associative array. The { } are not in the keys so calling str_replace directly won't work. I guess you can strip away all the { and } and use str_replace(), but I think that would also kill off the {if } statements.

Link to comment
Share on other sites

Well there are *many* pages that set template variables. You have to find the one that sets the variables for that email template.

 

Forget {SOME_NAME}. Just find the right file, add the new key in the array and in the template, use {key} where key is the key you put in the templates array.

Link to comment
Share on other sites

That is where I set them. I was just showing you the code that I put in there. Here is the whole thing:

 

$messenger->assign_vars(array(
				'USERNAME'		=> htmlspecialchars_decode($addr['name']),
				'TOPIC_TITLE'	=> htmlspecialchars_decode($topic_title),
				'FORUM_NAME'	=> htmlspecialchars_decode($forum_name),

				'U_FORUM'				=> generate_board_url() . "/viewforum.$phpEx?f=$forum_id",
				'U_TOPIC'				=> generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id",
				'U_NEWEST_POST'			=> generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&p=$post_id&e=$post_id",
				'U_STOP_WATCHING_TOPIC'	=> generate_board_url() . "/viewtopic.$phpEx?uid={$addr['user_id']}&f=$forum_id&t=$topic_id&unwatch=topic",
				'U_STOP_WATCHING_FORUM'	=> generate_board_url() . "/viewforum.$phpEx?uid={$addr['user_id']}&f=$forum_id&unwatch=forum",
				'AUTHOR'	            => htmlspecialchars_decode($user->data['username']),
				'MESSAGETEXT'	        => htmlspecialchars_decode($data['message']),
			));

 

That is showing the author but it is not showing the MESSAGETEXT. I changed it to "hello" instead of the $data['message'] and it showed it. Everywhere through the code it looks like it gets the message by doing $data['message'] but its not showing it

Link to comment
Share on other sites

Not at the moment. I'm not at home so I don't have access to anything phpBB related. Not to mention the files are on your side. (No, that does not mean you should post them here.) No one will bother looking through all of them especially if they're not familiar with the system. :D

Link to comment
Share on other sites

I had no intentions of posting the files here. I am drawing a huge blank right now about how to do something. I figured out that the $data was getting passed in through reference for another function in this same file. So I am thinking that because of this it is not available outside of that function. How can I get that data from that function to another function in that file.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.