The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Please help with mysql/php question
I have added a column to the post table in vbulletin and need to store multiple userids (similar to the way membergroupids from the user table is). I have already added it to the post table and it's named praisers (varchar(250)).
How do I go about adding a userid to it (1 at a time) and then showing all user's in that field on the postbit? |
#2
|
||||
|
||||
Kinda tricky, you might be better off userig a serialized array.
Do you only need the userids and usernames? |
#3
|
|||
|
|||
Yes, I only need the usernames, but I was going to store the userid's because there may be many ids stored for each post which (if stored usernames) may contain a string longer then 250.
Basically I am creating a praise the post hack for use on my forum. It works the opposite of report this post. A user can praise a post if they find it helpful. As of right now the hack sends the poster a pm notifying them that someone praised their post and then it updates ther poster's praises count (stored in the table user). I need to also add the person's userid (who is praising the post) to the field (praisers) in the table post when a post is praised. This way I can list all users who have praised this post on the postbit. As well I can restrict users from praising a post twice. |
#4
|
|||
|
|||
This is very important that I get this. Can anyone help? Andreas what is a serialized array?
|
#5
|
||||
|
||||
Isn't this likely to make people postbits very large if more than a couple "praise" it.
Why not just use the reputation system, or the "Thank You" hack. |
#6
|
|||
|
|||
Because this is being specifically created for a contest which is due to run when the hack is completed.
|
#7
|
|||
|
|||
To serialize an array you call the serialize() function. What serialize does is that it stores all the data, and information about the structure in 1 field. This field can then be stored.
After you retrieve the data, you can restore the original structure and data (an array in your case) with the unserialize() function. PS Even when only storing the userid's, varchar(250) can be too small very fast. |
#8
|
|||
|
|||
Do you have anymore documentation on this so I know what variables and such I need to successfully call the function?
|
#9
|
|||
|
|||
<a href="http://php.linux.hr/manual/en/function.serialize.php" target="_blank">http://php.linux.hr/manual/en/function.serialize.php</a>
Sorry not at my own PC right now, so no access to vB sources, but to use this you would do the following in a plugin: - Add your field to the datamanagers valid field list - Set the value You can find more on setting custom fields in our vB3.5 Tutorial section. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|