PDA

View Full Version : Usernote In Postbit v.2.0


tnguy3n
18 Nov 2005, 16:39
Modded by tnguy3n

Port of my Usernote In Postbit v.1.2 (http://www.vbulletin.org/forum/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
18 Nov 2005, 18:30
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
18 Nov 2005, 19:13
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
18 Nov 2005, 19:17
Very nice!

tnguy3n
18 Nov 2005, 23:06
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
19 Nov 2005, 07:11
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
19 Nov 2005, 17:47
Very nice! Been looking for a way to draw attention to usernotes. People don't take much notice generally.

Iceburg22
21 Nov 2005, 15:00
Installed

noonespecial
28 Nov 2005, 09:30
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
28 Nov 2005, 11:53
This could be done via template modification rather then plug in. ;) I believe. lol

J82980BA3E43
28 Nov 2005, 18:12
is there anyway to make this that only admins/mods can see it!

Onimua
28 Nov 2005, 18:24
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
28 Nov 2005, 19:38
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
29 Nov 2005, 19:01
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
29 Nov 2005, 20:09
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
30 Nov 2005, 10:03
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
30 Nov 2005, 15:48
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
14 Dec 2005, 14:28
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
21 Dec 2005, 12:50
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://www.vbulletin.org/forum/external/2005/12/4.gif

Xplorer4x4
21 Dec 2005, 13:36
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
21 Dec 2005, 14:39
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
22 Dec 2005, 14:49
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
22 Dec 2005, 15:36
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://www.vbulletin.org/forum/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
07 Jun 2006, 19:26
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
07 Jun 2006, 19:45
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
14 Jun 2006, 20:36
Anoter idea. Create user field (private) and update it using cron job.

Razasharp
18 Jul 2006, 16:52
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
27 Jan 2007, 00:45
any chance of something like this for vb 3.6.4 ?

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