PDA

View Full Version : usernames in qoutes for member/guests


ReBe
12-10-2011, 10:14 AM
Hi all,

i have make the usernames in quotes invisible vor guests. Members can see the names. I edit the template bbcode_quotes per TMS:

I replace
<img src="{vb:stylevar imgdir_misc}/quote_icon.png" alt="{vb:rawphrase quote}" /> {vb:rawphrase originally_posted_by_x, {vb:raw username}}
with
<img src="{vb:stylevar imgdir_misc}/quote_icon.png" alt="{vb:rawphrase quote}" />
<vb:if condition="$show['member']">{vb:rawphrase originally_posted_by_x, {vb:raw username}}
<vb:else />
<span style="font-weight:bold; font-size:10pt">{vb:rawphrase quote}</span>
</vb:if>
After that, i create new postcache. Now it works fine. But after some hours can members in some postings not seeing the names and guest see the names in some posts. If i now let the postcache create new, then the errors are gone.

I think if a guest look as the first user to a post, then the posting comes with no username in quote in the postcache. And if the a member looks to this posting, it comes from the postcache. And thats why the member not see the username. I hope you can follow me. :)

How can i fix it? We have realnames in our foum, so ist necassery to hide the usernames for guest/searchengines.

Lynne
12-10-2011, 05:37 PM
Perhaps you can write a plugin that turns postcaching off for guests?

ReBe
12-10-2011, 08:03 PM
Thanks for your answer. But i have no idea how to write a plugin.

--------------- Added 1323602161 at 1323602161 ---------------

I search this and the german vb-forum, but i found no good dokumantation for the plugin-creation.
I make a try, please help me:

Add-On: vBulletin
Hook: ?

PHP-Code:

if($vbulletin->$bbuserinfo[usergroupid] == '1'
{
$vbulletin->options['enablepostcache'] = 0;
}

ReBe
12-15-2011, 03:09 PM
Its really important for me. So it would be nice, if someone can help me. :)

Lynne
12-15-2011, 04:26 PM
Did you try that plugin? Perhaps at global_bootstrap_start? or global_bootstrap_end?

Also, make sure you develop plugins on your test site, not live site.

ReBe
12-15-2011, 06:11 PM
No, i dont try this, because the terminus "enablepostcache" comes from my fantasie. It would be mad random, if that's true. :)

kh99
12-15-2011, 07:04 PM
I haven't tried it, but you could try a plugin using hook location showthread_post_start and this code:

if($vbulletin->userinfo[usergroupid] == '1')
{
$post_cachable = 0;
}


That might work for showthread.php but I'm not sure if there's anywhere else that might be a problem. I think a better thing to do would be to arrange for specific posts to not be cached, which can be done by setting $parsedtext = '' at hook bbcode_parse_start. The problem is that you'd have to figure out how to tell if a post has the quote tag in it. You could set $parsedtext = '' all the time and effectively turn off all post caching, but I don't know if you want to do that. I know my site has a lot of guest activity so i don't think we'd even want to turn off caching for guests.

(BTW, you can't check the usergroup to decide whether or not to set $parsedtext = '' or you'll end up with the same problem you have now).

ReBe
12-15-2011, 08:42 PM
Thanks for your detailed answer. If i understand you right, i can use the template edits (see first post) + parse the postings for quote-tags and dont cache that quote-postings. I think that would be the best option for me. I will try that at the weekend.

I wonder that i´m be probably the only one with the wish to make the usernames for guests invisible. Social screening is a major theme and its a big advantage, if your realname will dont show for guests and searchengines.

ReBe
12-18-2011, 12:54 PM
I haven't tried it, but you could try a plugin using hook location showthread_post_start and this code:

if($vbulletin->$bbuserinfo[usergroupid] == '1')
{
$post_cachable = 0;
}


It does not work. I get a error message:
Fatal error: Cannot access empty property in /var/www/vhosts/xxxxx/httpdocs/showthread.php(811) : eval()'d code on line 1

kh99
12-18-2011, 12:58 PM
Yeah, sorry, it should have been this:

if($vbulletin->userinfo[usergroupid] == '1')
{
$post_cachable = 0;
}

ReBe
12-18-2011, 01:39 PM
Thanks, now it works. :)

--------------- Added 1324239532 at 1324239532 ---------------

Shit, i was to early happy. First it worked, but now registered users dont see the usernames in quotes in more and more postings. For guests it seems to be working, they dont see the usernames. At least i dont fount a posting, where guest see the usernames.

ReBe
12-20-2011, 06:22 PM
I?m going crazy... :) No one an idea, what the thinking error is?

Lynne
12-20-2011, 06:43 PM
Turn off post caching on the whole site? Or write a plugin that looks for a string that starts with:
<img src="images/misc/quote_icon.png" alt="Quote" />
and ends with:
<img class="inlineimg" src="images/buttons/viewpost-right.png" alt="View Post" /></a>

And remove it for unregistered users? That is the code from the postparsed table, if the post isn't cached then it is different. Also, that is from my site, your paths may be different - just look in your database to see what they look like.

ReBe
12-25-2011, 12:27 PM
I dont get it to work. I tried to set for a test in the "vbulletin settings"-->"server settings and optimization optins" the option "deactivate chache for content" to "yes". So now should be the postcache off, right? But with my bbcode_quote template change
<img src="{vb:stylevar imgdir_misc}/quote_icon.png" alt="{vb:rawphrase quote}" />
{vb:rawphrase originally_posted_by_x, {vb:raw username}}
repace with:
<img src="{vb:stylevar imgdir_misc}/quote_icon.png" alt="{vb:rawphrase quote}" />
<vb:if condition="$show['member']">{vb:rawphrase originally_posted_by_x, {vb:raw username}}
<vb:else />
<span style="font-weight:bold; font-size:10pt">{vb:rawphrase quote}</span></vb:if>
it does not work. First it works, but after 1-2 hours i see more and more posting, where for example registered member dont see the usernames in quote tag.

Lynne
12-25-2011, 05:42 PM
Is $show a registered variable in that template?

ReBe
12-25-2011, 09:37 PM
Yes, in the original-template is the string "<vb:if condition="$show['username']">".

--------------- Added 1324857009 at 1324857009 ---------------

Lynne
12-25-2011, 10:54 PM
But is $show[member] defined? You may want to try using is_member_of instead and see if that works.

ReBe
12-27-2011, 05:40 PM
Thanks, that works. But it works only, if i set in the vbulletin settings the "livetime of chaching posts" to 0 days. Seems my plugin:
if($vbulletin->userinfo[usergroupid] == '1')
{
$post_cachable = 0;
}
dont work. I try it with hook "global_bootstrap_init_start" and "showpost_start".

But anyway, how kh99 wrote, its better that posts with quotes are generally not be cached. So can this plugin with hook bbcode_parse_start work?

$parsedtext = '<img src="images/misc/quote_icon.png" alt="Quote" />'
{
$post_cachable = 0;
}
You wrote, that i should write a plugin that looks for a string that starts with:
<img src="images/misc/quote_icon.png" alt="Quote" />
and ends with:
<img class="inlineimg" src="images/buttons/viewpost-right.png" alt="View Post" /></a>
How can i do this? Thanks for your help untill now and sorry for my probably stupid questions. :)