PDA

View Full Version : Making parts of postbit selectively visible


AndrewD
08-10-2005, 05:44 PM
I've wondered for some time whether there is an easy way to flag part of a post that should only be visible to logged on users. The following hook into showthread_complete does the trick, allowing me to wrap .. tags around the text. Has anyone already come up with a better way, or have any advice on a better place for the hook? (Or worse, is this already a standard VB feature and I didn't realise??)

// Remove .. strings unless logged in
if ($vbulletin->userinfo['userid']==0) {
$postbits = preg_replace('#\[member\].*?\[/member\]#is', '', $postbits);
} else {
$postbits = preg_replace('#\[member\](.*?)\[\/member\]#is', '\\1', $postbits);
}