Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
PM or email a user, with a post quoted Ver. 1.3 Details »»
PM or email a user, with a post quoted Ver. 1.3
Version: 1.3, by sv1cec sv1cec is offline
Developer Last Online: Mar 2022 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 05-10-2005 Last Update: 05-17-2005 Installs: 5
 
No support by the author.

Well, this one was born, when I wanted to PM a user, and quoted a post he had made in my forums, in the PM.

Well, I could copy and paste, and then insert the quote tags, but instead, I did some code tweaking and here you go.

This hack will create a new menu item, in the drop-down menu which is shown when you click on a user's name in the postbit. When you click on that menu item, you will be taken to the PM form, with the Recipient field, filled with the poster, the title field filled with the original thread's title and in the message box, you will have the text of the post as a quote.

Also, it will add a small icon, in the first postbit line, which when clicked will redirect you to the new PM form, with only the text from the selected post, quoted. You are now free to enter any recipients you want. Thanks to Amykhar for this, more generic version.

Remember to save the third image below in your disk and then upload it in the images/buttons directory in your server.

Easy mod, just two edits.

Version 1.0

Initial version with only PM functionality, called from the user drop-down menu and sending the PM to the user who posted the post.

Version 1.1

More generic version, which allowed to send a PM with a quote of a post, to any member of your forums, via the small icon on the top of each postbit.

Version 1.2

This version added the same functionality as the one described above, but using an email instead of a PM. Users who want to upgrade, just scroll down in the installation instructions, until you find the section dealing with the email. Remember to save the fourth image below in your disk and then upload it in the images/buttons directory in your server, if you want to use the email functionality.

Version 1.3 (current)

One thing I didn't like about the way this hack worked, was that upon sending the PM or the email, it didn't return you to the post you were, when you started it. So I did some small changes to implement that functionality. Now, after the PM or the email is send, you are returned to the post you were before.

For a new installation, just follow the instructions in the txt file. For upgrading here is what you have to do:

1. Open your private.php file and find:

PHP Code:
// change for pm with post quote
            
if ($_REQUEST['postid'])
            {
                
$text $DB_site->query_first("
                    SELECT pst.threadid, thrd.title, pst.pagetext
                    FROM " 
TABLE_PREFIX "post AS pst 
                    LEFT JOIN " 
TABLE_PREFIX "thread AS thrd ON(thrd.threadid = pst.threadid)
                    WHERE pst.postid=" 
intval($_REQUEST['postid']) . "
                "
);
                if (
$_REQUEST['stripquote'])
                {
                    
$pagetext strip_quotes($text['pagetext']);
                }
                else
                {
                    
$pagetext $text['pagetext'];
                }
                
$pagetext trim(htmlspecialchars_uni($pagetext)); 
This is code you added, when you installed the hack. Below that, add:

PHP Code:
$return_url="showthread.php?p=$_REQUEST[postid]"
In the same file find:

PHP Code:
// ############################### start insert pm ###############################
// either insert a pm into the database, or process the preview and fall back to newpm
if ($_POST['do'] == 'insertpm')
{
    
// get an array of incoming data
    
$pm = &$_POST
Below that, add:

PHP Code:
$return_url=$_POST['return_url']; 
In the same file find:

PHP Code:
eval(print_standard_redirect('pm_messagesent')); 
Above that, add:

PHP Code:
            if ($return_url!='')
            {
                
$url=$return_url;
            }
            else
            {
                
$url "private.php?$session[sessionurl]";
            } 
Open your pm_newpm template and find:

HTML Code:
<input type="hidden" name="receipt" value="0" />
Below that, add:

HTML Code:
<input type="hidden" name="return_url" value="$return_url" />
Save template.

Open file sendmessage.php and find:

PHP Code:
            // for email with quote
            
if ($_REQUEST['postid'])
            { 
Right below that, add:

PHP Code:
$url="showthread.php?p=$_REQUEST[postid]"
That's it, you will now be returned to the post you were, before sending the PM or the email.

I hope you like it.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 05-11-2005, 07:18 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nicely done. Hopefully, I won't confuse anybody with what I'm about to share, because his hack works perfectly as described. But, I wanted a wee bit more. I wanted to be able to quote a post in a private message to ANY member, not just the author of the post.

To do this, I had to move his code snippet as follows:
In his directions, he said:
Code:
Open file private.php and find the first occurence of:

				if (empty($recipients))
				{
					$pm['recipients'] = '';
				}
				else
				{
					$pm['recipients'] = implode('; ', $recipients);
				}
				
Below that, add:
To do the more generic version, that should be:
Code:
Find:
// insert username(s) of specified recipients
			if ($_REQUEST['userid'])

Above that add:
(Use his code.)

Then, in the postbit or postbit legacy templates, in addition to the edit he suggested,
Find:
Code:
<if condition="$show['reportlink']"><a href="report.php?$session[sessionurl]p=$post[postid]"> <img class="inlineimg" src="$stylevar[imgdir_button]/report.gif" alt="$vbphrase[report_bad_post]" border="0" /> </a> &nbsp;</if>
Add After:
Code:
<if condition="$show['pmlink']">
<a href="private.php?$session[sessionurl]do=newpm&amp;postid=$post[postid]&amp;userid="> <img class="inlineimg" src="$stylevar[imgdir_misc]/pmquote.gif" alt="Quote post in private message" border="0" /></a>	</if>
I'm attaching the image that I used, which I put in the misc images directory
Reply With Quote
  #3  
Old 05-11-2005, 07:28 PM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why don't you just delete the preselected recipient and add the recipients you want, to the PM form which will open?

You may even remove the part of the code which adds the "Re. your post in thread: this and that" and the "In your post, you wrote:" and have a more generic version.
Reply With Quote
  #4  
Old 05-11-2005, 07:40 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

True. That would work for me. But, sometimes users aren't that sophisticated.
Reply With Quote
  #5  
Old 05-11-2005, 08:05 PM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, here is the second version, which adds your functionality as well. The only thing it retains from the original post, is the quoted text.

If one uses the menu selection, all three fields get filled up as before.

Rgds
Reply With Quote
  #6  
Old 05-12-2005, 12:23 AM
dsboyce8624 dsboyce8624 is offline
 
Join Date: May 2005
Location: New Jersey
Posts: 413
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Worked like a charm.

Thanks.
Reply With Quote
  #7  
Old 05-12-2005, 02:54 AM
bigcurt's Avatar
bigcurt bigcurt is offline
 
Join Date: Nov 2004
Location: KierDarby.php
Posts: 1,009
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice hack man! How do I add that admin cp edit user conditional in there?
Reply With Quote
  #8  
Old 05-12-2005, 03:42 AM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bigcurt8998
Nice hack man! How do I add that admin cp edit user conditional in there?
Easy, find this:

HTML Code:
<if condition="$post['userid']">
	<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr>
Add below:

HTML Code:
<if condition="$bbuserinfo['usergroupid']=='6'">
			<tr><td class="vbmenu_option"><span onmouseover="this.style.cursor='pointer';" onClick="window.open('admincp/user.php?do=edit&userid=$post[userid]','edit','width=1024,height=350,scrollbars=yes')"><b>AdminCP Edit $post[username]</b></span></td></tr>
		</if>
Rgds
Reply With Quote
  #9  
Old 05-12-2005, 04:46 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice hack, I could have used that alot in the past. It would be nice having that here for the service requests forum.
Reply With Quote
  #10  
Old 05-12-2005, 04:58 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In your postbit template (or postbit_legacy).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:54 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04931 seconds
  • Memory Usage 2,332KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (4)bbcode_html
  • (8)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete