PDA

View Full Version : Usernote In Postbit v.2.0


tnguy3n
11-17-2005, 10:00 PM
Modded by tnguy3n

Port of my Usernote In Postbit v.1.2 (https://vborg.vbsupport.ru/showthread.php?threadid=73599) for vb3.0

This mod shows number of usernote in postbit. It only shows when the user has a note.

Installation time: 1-2 mins
Plugin: 1
Tempate mod: 1

#--------------
INSTALLATION:

1. Upload plugin-usernote.xml in Plugin Manager

2. Open postbit (or postbit_legacy) template,

FIND:
<div>
$vbphrase[posts]: $post[posts]
</div>

BELOW, ADD:

<if condition="$post[usernote]"><div>
Usernote: <a href="usernote.php?$session[sessionurl]u=$post[userid] title="see $post[username]'s usernotes">$post[usernote]</a>
</div></if>

nexialys
11-18-2005, 04:30 PM
please mention that this hack will add a query for each post displayed on page... so if you have 20 posts per page, you will have an overhead of 20 new db queries...

Diana Notacat
11-18-2005, 05:13 PM
I love this idea if it weren't for a whole load of extra queries. Maybe there's a way to fix?

What about being able to add this to the same location as the new PM messages? At least the user can see when they have usernotes, and it (hopefully) shouldn't add too many extra queries?

Snake
11-18-2005, 05:17 PM
Very nice!

tnguy3n
11-18-2005, 09:06 PM
please mention that this hack will add a query for each post displayed on page... so if you have 20 posts per page, you will have an overhead of 20 new db queries...

you're sure a criticizing bug :p but nice catch thou.
okie, I've changed the hook to showthread_postbit_create

RMS-Chef
11-19-2005, 05:11 AM
you're sure a criticizing bug :p but nice catch thou.
okie, I've changed the hook to showthread_postbit_create

Was that supposed to limit the queries?
I just tried and a page of 15 posts with 11 jumped to 26 after install.

FleaBag
11-19-2005, 03:47 PM
Very nice! Been looking for a way to draw attention to usernotes. People don't take much notice generally.

Iceburg22
11-21-2005, 01:00 PM
Installed

noonespecial
11-28-2005, 07:30 AM
If the query issue can be addressed I'll be installing this. However I don't think I can handle that many new queries per page.

Xplorer4x4
11-28-2005, 09:53 AM
This could be done via template modification rather then plug in. ;) I believe. lol

J82980BA3E43
11-28-2005, 04:12 PM
is there anyway to make this that only admins/mods can see it!

Onimua
11-28-2005, 04:24 PM
is there anyway to make this that only admins/mods can see it!

I would assume adding conditional tags around the code in the template would do it.

Would install, but from people talking about the extra queries... no thanx. Excellent idea though.

Maybe cache the usernotes and update them hourly or something?

noonespecial
11-28-2005, 05:38 PM
This could be done via template modification rather then plug in. ;) I believe. lol

Well, if you didn't want the # of usernotes to show.

Ig@r
11-29-2005, 05:01 PM
Thanks!
Install.

Still this hack produced lots of extra querys.... :speechless:
I think it would be much better use JOIN with post table instead of running extra query for each post....

J82980BA3E43
11-29-2005, 06:09 PM
I would assume adding conditional tags around the code in the template would do it.

Would install, but from people talking about the extra queries... no thanx. Excellent idea though.

Maybe cache the usernotes and update them hourly or something?

how I do that ! :ermm:

noonespecial
11-30-2005, 08:03 AM
Any one going to take a shot at reducing the queries? I want to install this on my board ... I may do it if no one else does.

Ig@r
11-30-2005, 01:48 PM
Any one going to take a shot at reducing the queries? I want to install this on my board ... I may do it if no one else does.

noonespecial, please do, I'm sure everyone will really appreciate it.

J82980BA3E43
12-14-2005, 12:28 PM
how make this that only admins/mods can see if a member have a usernote and no one else can't see it!!
please :nervous:

J82980BA3E43
12-21-2005, 10:50 AM
how make this that only admins/mods can see if a member have a usernote and no one else can't see it!!
please :nervous:

nobody whom can help me please https://vborg.vbsupport.ru/external/2005/12/4.gif

Xplorer4x4
12-21-2005, 11:36 AM
NOT TESTED but try:
<if condition="$post[usernote]" AND "is_member_of($bbuserinfo, array(1,2,3))"><div>
Usernote: <a href="usernote.php?$session[sessionurl]u=$post[userid] title="see $post[username]'s usernotes">$post[usernote]</a>
</div></if>
And replace 1,2,3 with the porper usergroup ids.

J82980BA3E43
12-21-2005, 12:39 PM
NOT TESTED but try:
<if condition="$post[usernote]" AND "is_member_of($bbuserinfo, array(1,2,3))"><div>
Usernote: <a href="usernote.php?$session[sessionurl]u=$post[userid] title="see $post[username]'s usernotes">$post[usernote]</a>
</div></if>
And replace 1,2,3 with the porper usergroup ids.

Thanks for your answer, but he does not do it he gives a error

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING

tnguy3n
12-22-2005, 12:49 PM
Try:
<if condition="$post[usernote] AND is_member_of($bbuserinfo, array(1,2,3))"><div>
Usernote: <a href="usernote.php?$session[sessionurl]u=$post[userid] title="see $post[username]'s usernotes">$post[usernote]</a>
</div></if>

J82980BA3E43
12-22-2005, 01:36 PM
Try:
<if condition="$post[usernote] AND is_member_of($bbuserinfo, array(1,2,3))"><div>
Usernote: <a href="usernote.php?$session[sessionurl]u=$post[userid] title="see $post[username]'s usernotes">$post[usernote]</a>
</div></if>


Yes thanks man these won works https://vborg.vbsupport.ru/external/2005/12/3.gif
but have him what-adapted


<if condition="$post[usernote] AND is_member_of($bbuserinfo, array(6,7))"><div>
<a title="$post[usernote]" href="usernote.php?$session[sessionurl]u=$post[userid]">
<img src="images/buttons/notes.gif" href="usernote.php?$session[sessionurl]u=$post[userid] title=" border="0" /></a>
</div></if>
http://img386.imageshack.us/img386/4716/pics1hc.jpg

jdh
06-07-2006, 05:26 PM
Well, one suggestion I would have for reducing the queries on boards where only admins/mods are using the notes feature would be to put the conditional in the actual plug-in....

Basically, an IF wrapper like the following around the existing XML code seems to work quite well (blatantly 'borrowed' from the MEMBER.PHP file):


if
(
$permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canpostothersusernotes']
)


This actually has two benefits... The first is that the database query will only run for those users who can actually see the user notes. Further, it's better than hard-coding a group conditional into the template. This just uses the standard vBulletin permissions to determine if a user can view their own notes and/or others notes, and if they can, then the query will run and the $post['usernote'] value will be populated.

I've tested this on my own board, and it seems to work quite well.

To be fair, this doesn't reduce the queries for boards where everybody can see usernotes about each other, but it will help for those boards where usernotes are used for admin-only purposes.

eXaulz
06-07-2006, 05:45 PM
Hint: You could simply construct an Array of all users that posted in the Thread, then add to the Array how many usernotes they have, if they have any, the username and userid, etc. It's just one query that you'll be adding, if you do this method. Then, in the postbit, just call something like:


<?php

<if condition="$user_details[ THE_USER_ID_OF_THE_POST_CREATOR ]['usernotes_count'] != 0">
Total Usernotes: <a href="usernote.php?uid=$user_details[ THE_USER_ID_OF_THE_POST_CREATOR ]['userid']">$user_details[ THE_USER_ID_OF_THE_POST_CREATOR ]['usernotes_count']</a>
</if>

?>


Atleast I think that would work. :p

Ig@r
06-14-2006, 06:36 PM
Anoter idea. Create user field (private) and update it using cron job.

Razasharp
07-18-2006, 02:52 PM
Anoter idea. Create user field (private) and update it using cron job.

This sounds like the most efficient solution... anyone know how to create such a cron/script?

Caerydd
01-26-2007, 10:45 PM
any chance of something like this for vb 3.6.4 ?

anestetic
11-01-2007, 11:12 AM
for 3.6.8 ?
yokmu 3.6.8 için uye notlarını profilde göstermeye yarayan eklenti?