The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Problem writing a plugin to modify lastposter on forum homepage.
I'm in the process of writing plugins to modify the displayed username of anyone who has an email address in their username. I have it working fine in several places, but I'm stuck on how to get it working on the "Last Post" part of the main forum listing on the homepage. I've tried every variation on the following code that I can find. The code works and properly modifies the variables I'm targeting, but no matter what I do, the templates still display the unmodified version of the lastposter username.
I've got the following code attached to the "forumbit_display" hook... Code:
if($pos=strpos($lastpostinfo['lastposter'],"@")) { $lastpostinfo['lastposter']= substr($lastpostinfo['lastposter'],0,$pos); } Code:
// Attached this dirty code to forumhome_complete hook. //There's got to be a better way than doing this preg_replace $forumbits=preg_replace("/([a-zA-Z0-9]+)(@)([a-zA-Z_\-.]+)/","$1",$forumbits); EDIT: I've got it working properly now!!! I could have sworn I tried this already, but I attached the following code to the "forumbits_display" hook and suddenly it works: Code:
foreach($vbulletin->forumcache as $k=>$v) { if($pos=strpos($v['lastposter'],"@")) { $vbulletin->forumcache[$k]['lastposter']= substr($v['lastposter'],0,$pos); } } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|