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 [member] .. [/member] 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??)
Code:
// Remove [member]..[/member] 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);
}