View Full Version : adding an action
khaleel
01-20-2005, 11:01 AM
Cant see any tutotrials or anything on how to add a simple action. I want to add a buy avatar action
bump
khaleel
01-22-2005, 06:20 PM
Anyone
khaleel
01-24-2005, 09:48 AM
Anyone?
Link14716
01-25-2005, 03:55 AM
No, there are no tutorials.
khaleel
01-25-2005, 04:30 PM
So .... how - do - i - do this?
Link14716
01-25-2005, 06:59 PM
Well, assuming you know PHP and how vB adds an avatar, it shouldn't be super hard.
Here's an action file that _may_ work on 0.95b. Add it through the action manager.
EDIT: Removed some uCS 1.0.x only code. It needs a new template as well.
Make a new template: uttstore_inputs_file
<input type="hidden" name="MAX_FILE_SIZE" value="$field[maxsize]" /><fieldset style="text-align: right;"><legend>$field[topphrase]</legend>
<div style="float: left;">$field[mainphrase]</div> <input type="file" name="$name" value="$value" size="$field[size]"></fieldset>
This action probably has a few bugs though, so don't think that just because I am posting it that it is stable. ;)
EDIT2: You also need to change this in includes/functions_uttstore.php:
Find:
function uttstore_globalize_fields($fields) {
// Because damnit, I am about to gouge my eyes out.
$_FIELD = $_POST['_FIELDS'];
foreach ($fields as $name => $field) {
if ($field['datatype'] == 'INT') {
// integer value - run intval() on data
$_FIELDS["$name"] = intval($_FIELD[$name]);
} elseif ($field['datatype'] == 'POINTS') {
$_FIELDS["$name"] = uttpoints_number_format($_FIELD[$name]);
} elseif ($field['datatype'] == 'STR_NOHTML') {
// html-safe string - trim and htmlspecialchars data
$_FIELDS["$name"] = htmlspecialchars_uni(trim($_FIELD[$name]));
} elseif ($field['datatype'] == 'STR') {
// string - trim data
$_FIELDS["$name"] = trim($_FIELD[$name]);
} else {
$_FIELDS["$name"] = $_FIELD[$name];
}
}
return $_FIELDS;
}
Replace with:
function uttstore_globalize_fields($fields) {
// Now with the added bonus of working!
$_FIELD = $_POST['_FIELDS'];
// Some backported code from 1.0.x is in here.
foreach ($fields as $name => $field) {
if ($field['bypassfields'] != true) {
$data = $_FIELD[$name];
} else {
$data = $_POST[$name];
}
if ($field['datatype'] == 'INT') {
// integer value - run intval() on data
$_FIELDS["$name"] = intval($data);
} elseif ($field['datatype'] == 'POINTS') {
$_FIELDS["$name"] = uttpoints_number_format($data);
} elseif ($field['datatype'] == 'STR_NOHTML') {
// html-safe string - trim and htmlspecialchars data
$_FIELDS["$name"] = htmlspecialchars_uni(trim($data));
} elseif ($field['datatype'] == 'STR') {
// string - trim data
$_FIELDS["$name"] = trim($data);
} else {
$_FIELDS["$name"] = $data;
}
}
return $_FIELDS;
}
khaleel
01-26-2005, 12:38 PM
hey thanks!
but it says
There has been an error in the upload. Please ensure that the file has been correctly selected and that the upload has taken place successfully
when trying to upload any avatar :(
Link14716
01-26-2005, 06:50 PM
Apparently you'll get that if you try to upload one (as opposed to getting it through a URL). I'm not sure why, though.
Apparently you'll get that if you try to upload one (as opposed to getting it through a URL). I'm not sure why, though.
So the best thing we can do is WAIT untill we can get our hands on 1.0.x :D
khaleel
01-26-2005, 07:03 PM
ill have to wait then, the new one should be great i hope we can buy things like avatars and items (pictures) that we can show as cars or products in the userprofile or even credit cards and usercshops like invisionboards and phpbbs
by the way i had to undo those edits as that stopped the shop completly working
Reeve of shinra
01-26-2005, 07:45 PM
If you dont want to wait, or dont care if about making users buy an avatar each time they want to upload something new, create a new usergroup that allows avatar changing and use the already existing add to usergroup feature of ushop.
Link14716
01-26-2005, 08:40 PM
If you dont want to wait, or dont care if about making users buy an avatar each time they want to upload something new, create a new usergroup that allows avatar changing and use the already existing add to usergroup feature of ushop.
And/or delete the template I told you to add to only show the URL field until I fix the bug with uploads. :)
Link14716
01-28-2005, 09:22 PM
Alright, I got the upload file error fixed. In your uttstore_standard_inputs template:
Find: <form action="ushop.php" method="post">
Replace with: <form action="ushop.php" method="post" enctype="multipart/form-data">
carolmyt
02-04-2005, 04:58 PM
First of all, I installed this hack yesterday, and I'm totally addicted to it!
Is the customavatar.php file customizable in a way that I could use it to allow members to buy avs of different sizes for different prices?
Please keep in mind that I'm very new to php. There is no explanation too basic for me, ;).
THANKS!
Link14716
02-04-2005, 08:41 PM
No, there is not. It just allows members to purchase avatars up to the maximum allowable size as specified in the usergroup manager.
carolmyt
02-04-2005, 10:40 PM
Ok, thanks anyway!
carolmyt
02-07-2005, 01:09 PM
I installed this with no problems, and while it is working for me and other administrators, regular members are getting an error message. They're telling me the message is telling them the avs are too big, and referencing the size as -1 by -1, or 1 byte. They all tell me that the avs are within restricted size, and the one I checked on was. Any idea why this is happening? People are starting to get irritable.
Ok, I figured out what the problem is, but I don't know how to fix it. In order to be able to purchase the custom av, the usergroup has to be set to allow uploading of custom avs, but if that is set to yes, there is no need to buy one, because then they can just upload it for free through the user cp.
So, how do I fix this?
carolmyt
02-08-2005, 09:22 PM
Anybody?
carolmyt
02-12-2005, 04:57 PM
Is nobody using this option?
Wifey
03-15-2005, 10:22 PM
What am I doing wrong? I installed it but there is no table to upload the avatar. It's working but when you go to the confirmation page to upload the avatar it's not there...
Link14716
03-16-2005, 12:21 AM
I'm going to close this thread and release the avatar action in another thread.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.