The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Email for PM change
OK
I would like to change the body of the email sent to users when a PM is received, currently the email will read: Dear $touserinfo[username], You have received a new private message at $vboptions[bbtitle] from $fromusername, entitled "$plaintext_title". To read the original version, respond to, or delete this message, you must log in here: $vboptions[bburl]/private.php This is the message that was sent: *************** $plaintext_message *************** I would like to use a custom field I have setup to display the users "Real Name" I Have that inputed into "field2" of their profile I dont know where/when the $fromusername collects the name...so I cant just put $bbuserinfo[field2] ? Can I How do I do this? |
#2
|
|||
|
|||
Does anyone know if this can be done?
|
#3
|
|||
|
|||
The message is sent in function post_save_each() in includes/class_dm_pm.php. It looks like you could create a plugin using hook location pmdata_postsave_recipient to set a new value for $fromusername.
|
#4
|
|||
|
|||
Oh ok thats a start, except I have never worked with creating plugins
is there any resources here I can look at to learn a little more, or is there any plugins written close to what I need I can copy from |
#5
|
|||
|
|||
Here's the manual page on creating a plugin: https://www.vbulletin.com/docs/html/main/add_plugin (or at least the instructions for using the admincp - it doesn't say much about the coding part). You just need to add some php code in the large text area that sets $fromusername to what you want. If you want to see where it will be executed, look at includes/class_dm_pm.php and search for 'pmdata_postsave_recipient'.
|
#6
|
|||
|
|||
Hi,
I had the same need so I just got done writing and testing a similar plugin. Here it is: Code:
$ug = $user['usergroupid']; $admin_message = ""; if (($user['options'] & $this->registry->bf_misc_useroptions['emailonpm']) AND ($ug == 5 OR $ug == 6)) { $touserinfo =& $user; $plaintext_parser->set_parsing_language($touserinfo['languageid']); $admin_message = $plaintext_parser->parse($this->fetch_field('message'), 'privatemessage'); $admin_message = "Message:\n*********\n" . $admin_message . "\n*********\n"; } In my above example, we normally dont show the contents of the PM. This way people have to come to the website to see what it said. Here, I'm checking if its a mod or an admin, and creating a NEW variable called admin_message. I then go into the pmreceived email template and add the new variable "$admin_message" to the template. This will only have a value if the PM is going to an admin or to a mod. I hope this helps. |
#7
|
|||
|
|||
OK excellent start! as I have no idea how to creat a plugin using the data I need
So what could I do if I just needed to collect the data from $bbuserinfo[field2] and have it displayed on the PM when sent I think yours is a little more advance if I undertsand correctly? Could I just add $bbuserinfo[field2] to the new variable "$admin_message" Again, I am just trying to display the users real name that I have set in field2 to any PM sent by this usergroup I really appreciate your help! --------------- Added [DATE]1329938407[/DATE] at [TIME]1329938407[/TIME] --------------- Sorry I know I got that wrong, you are setting the value of $admin_message only if its a mod or admin user How could I use that to display the field 2? |
#8
|
|||
|
|||
Well, first you're gonna want to find the group of the user SENDING your PM. This might be as easy as checking:
$vbulletin->userinfo['usergroupid']; So in MY example, you would test for $vbulletin->userinfo['usergroupid'] == ### for the if. This makes sure that the logic is ONLY done for people of the usergroup you want. Then, make a variable (using admin_message is ok, since it is not used otherwise) and give it the value of $bbuser['field2']. Should be straight forward, so long as those 2 variables are in scope. You may need to globalize them. Anyone else wanna weigh in here? |
#9
|
|||
|
|||
OK thanks!
I am going to try this now This will be awesome if it works...we have some admins that dont knnow who is sending them emails, because of the userid handle --------------- Added [DATE]1329942354[/DATE] at [TIME]1329942354[/TIME] --------------- OK, I feel dumb .I am stuck on a small detail... Where am I adding this new variable? Looking around cant find "pmreceived" OR can I just put the $bbuserinfo[field2] right in the hook? sorry to be a pain! |
#10
|
|||
|
|||
Cant get it to work, no errors just the results arent there
damn |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|