vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   uCash & uShop (https://vborg.vbsupport.ru/forumdisplay.php?f=100)
-   -   Custom Avatar Action (https://vborg.vbsupport.ru/showthread.php?t=78196)

Link14716 03-16-2005 12:32 AM

Custom Avatar Action
 
1 Attachment(s)
Here is the custom avatar action from 1.0.0 made to work on 0.95. It should work correctly, if you already installed it from the other thread, then upload this new version of action.customavatar.php.

Make a new template: uttstore_inputs_file:
HTML Code:

<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>

In your uttstore_standard_inputs template:

Find:
HTML Code:

<form action="ushop.php" method="post">
Replace with:
HTML Code:

<form action="ushop.php" method="post" enctype="multipart/form-data">
In includes/functions_uttstore.php:
Find:
PHP Code:

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:
PHP Code:

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;


Finish this by making a new action for uttstore/action.customavatar.php (and obviously upload it to the right location).

stevey 03-21-2005 05:59 PM

hi i have try to do this but i get this error when you click on the confirm button:

Fatal error: Call to undefined function: uttstore_construct_input_fields() in /home/co4mp2u/public_html/uttstore/action.customavatar.php on line 47

Link14716 03-21-2005 06:58 PM

Looks like I forgot to change the function name so it will work with 0.95. It is typo'd in 0.95. Try the file now.

stevey 03-22-2005 12:19 AM

works now :) thanks, i just have to figure out how to stop people uploading avatars through there control panel now, im guessing i just turn the option off in the permissions

Link14716 03-22-2005 12:36 AM

Quote:

Originally Posted by stevey
works now :) thanks, i just have to figure out how to stop people uploading avatars through there control panel now, im guessing i just turn the option off in the permissions

Turn the option off in the usergroup permissions, yes.

stevey 03-22-2005 07:38 AM

cool thanks :)

Wifey 04-01-2005 08:09 PM

1 Attachment(s)
Mine is not working. I reuploaded the file, everything. I have everything done correctly, any ideas? I attached what isn't working - there isn't an input field for a custom avatar period. No clue why.

Wifey 04-03-2005 08:38 PM

I get this on another add-on I've tried installing - the gift one - what am I doing wrong? I've got everything set up perfectly in my forum...I installed the store and every other hack y'all've made (yes, because I'm cool I can use a contraction within a contraction, thereby just proving what a Texan I am, Oye)

Any help would be GREAT!

Link14716 04-05-2005 03:07 PM

Quote:

Originally Posted by ashkarita
Mine is not working. I reuploaded the file, everything. I have everything done correctly, any ideas? I attached what isn't working - there isn't an input field for a custom avatar period. No clue why.

Well, I could see the upload part not showing if you didn't make the template as mentioned in the first post, however, the URL one still would show up. Try reverting the uttstore_standard_confirmation and uttstore_standard_inputs templates.

carolmyt 04-09-2005 08:50 PM

So, this will override the fact that the usergroup won't have permission to upload there own avatar?


All times are GMT. The time now is 12:16 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01210 seconds
  • Memory Usage 1,763KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete