Thread: Miscellaneous Hacks - Private Message button in postbit footer
View Single Post
  #57  
Old 07-13-2014, 10:08 PM
thetechgenius's Avatar
thetechgenius thetechgenius is offline
 
Join Date: Jun 2014
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Couldn't this be done by adding a Plugin? I added a plugin to add an "Add Friend" button to the same place in the postbit.

Edit:

I just found an easier way of doing this, without editing any templates, only the Additional.css, and Creating a new plugin.


Create a new plugin:

Product: vBulletin
Hook Location: postbit_display_complete
Title: send_pm_user (could be anything you want)
Execution Order: 5


Plugin PHP Code:

Code:
$postuserinfo = fetch_userinfo($post['userid'], 128);

{
    $template_hook['postbit_controls'] .= '<span class="sendpm"><a href="private.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=newpm&u=' . $post['userid'] . '">' . construct_phrase($vbphrase['send_pm'], $post['username']) . '<img class="pmimg2" alt="Send PM" src="images/site_icons/pm.png"></a><span class="seperator"></span></span>';
}
Change the code in RED to the image location of the Send PM Image that you downloaded from the first post.



Add this to Additional.css:

Code:
/* Add Send PM to Postbit - Begin */

.pmimg2{margin:-2px;}
.sendpm{position: absolute;right: 495px;}  

/* Add Send PM to Postbit - End */
You may need to change the code in RED to align the button correctly. Lower Number = Right, Bigger Number = Left.

I have an "Add Friend" button in my postbit, so I had to align my "Send PM" before that, so mine will probably be different then yours. Just mess around with the code in RED to get the button exactly were you want it.




All Credit goes to the OP trilOByte, I just figured out another way to implement his addon.

Note: You must know that if you add this mod this way, all usergroups will be able to see the button, including Guests. If you only want to allow specific usergroups, then you will have to edit the "postbit" or "postbit_legacy" template(s) and add the code manually. If anyone needs the code for the template version, let me know and I will post my code I use on my forum.
Reply With Quote
2 благодарности(ей) от:
Fields, stained
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01060 seconds
  • Memory Usage 1,773KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (2)post_thanks_box_bit
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete