Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > Premium Archives > vbArticles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[Pending] Not Require an image Icon Details »»
[Pending] Not Require an image Icon
Version: , by ptmuldoon ptmuldoon is offline
Developer Last Online: Jun 2014 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 02-21-2005 Last Update: Never Installs: 0
 
No support by the author.

I went to submit my first article, and I'm being told that I have to include an image icon. I looked in the admin settings, and I have selected No for "Use Category Icons"

Is there a way to submit articles that don't have an image icon?

Also, not a big deal, but after not having an image icon, and if you hit the back button on your browser, you lose your article, and have to re-enter the entire thing. Not that big a deal, but a little annoying. That could be my brower though. I'm using mozilla.

I know enough about php to generally be able to find and understand the code a little bit, but at same time to do series damage. So looking at the code in the artcles.php file, I've found this
PHP Code:
$path $path.'/';
    if (
is_uploaded_file($icon['tmp_name']))
    {
        if (
file_exists("$path$icon['name']))
        {
            eval(
print_standard_error('vbart_filealreadyexists'));
        }

        
$result copy($icon['tmp_name'], "$path$icon['name']);
        if (!
$result)
        {
            
$error ob_get_contents();
            eval(
print_standard_error('vbart_errorwriting'));
        }

        
$newpath $vbart_options['vbartartimgpathab'].$artid."/";
        
$iconpath $newpath.$icon['name'];
          echo 
'<p>'.$vbphrase['vbart_imguploadsuccess'].'</p>';
        
$DB_site->query("UPDATE " TABLE_PREFIX "articles_article SET icon='$iconpath' WHERE articles_articleid='$artid'");
    }
    else
    {
        eval(
print_standard_error('vbart_invalidfile'));
    } 
Now, what I'm thinking is to edit that code to first look if the user supplied an image for the article. If they did, then upload and use that image with the article. But if they did not provide an image, then the script would use a default image that on your server, likely in the default folder where your article images will go.

So is this possible? I think it may just be a matter of either altering the above code, or adding in another if/else command. I hope I'm on the right track at least.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-22-2005, 12:23 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep you're right, you remove the else clause in the code above. But I will not offer support if anything goes wrong.
I intended all articles to have icons to make the layout uniform.
Reply With Quote
  #3  
Old 02-22-2005, 12:47 PM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I'm not thinking of removing the else clause, but to expand upon it. If I understand everything, images are placed in an images/articles/5/ folder, with a new folder number being added for each article submitted.

So I'm thinking you place a default.gif in your images/articles folder.

Then you add in an additional elseif above the else clause. Now, when a user submits an article, first it will look for the user submitted image. If thats not there, it will look for the default.gif to use. And if it can't find either, to give you the error message of no image found.

Again, I know just enough about php to be dangerous and mess something up. But I'm going to give this a shot tonight when I get back to my home pc, and take a look at my php intro books that I have.
Reply With Quote
  #4  
Old 02-22-2005, 03:01 PM
mr.gamesbay's Avatar
mr.gamesbay mr.gamesbay is offline
 
Join Date: Sep 2004
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Agree, the should be a default gif, if someone t want to upload a articles picture.
Reply With Quote
  #5  
Old 02-22-2005, 03:31 PM
jluerken's Avatar
jluerken jluerken is offline
 
Join Date: Aug 2003
Location: Germany
Posts: 1,016
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mr.gamesbay
Agree, the should be a default gif, if someone t want to upload a articles picture.
Yes thats a really good idea.
Reply With Quote
  #6  
Old 02-22-2005, 04:49 PM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Also, Just as an FYI, that I noticed that although if you didn't include an image, that the article is still actually being submitted, as I see it waiting for approval in the admin panel. I'll see if I can understand any of the code enough to add elseif command for a default pic, but I think I'm going to really mess it up. Somebody with better coding skills may want to do it as well.
Reply With Quote
  #7  
Old 02-23-2005, 03:33 AM
mr.gamesbay's Avatar
mr.gamesbay mr.gamesbay is offline
 
Join Date: Sep 2004
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ptmuldoon
Also, Just as an FYI, that I noticed that although ifyou didn't include an image, that the article is still actually beingsubmitted, as I see it waiting for approval in the admin panel. I'llsee if I can understand any of the code enough to add elseif commandfor a default pic, but I think I'm going to really mess it up. Somebodywith better coding skills may want to do it as well.
Yes,yesterday a user submits 9 Times the same Article, he didn?t know whatmissing and what is wrong. I turn this mod offline, I hope there will be a fix.
Reply With Quote
  #8  
Old 02-23-2005, 11:35 AM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i crashed and bombed at trying to understand how to add in the code. Perhaps Cinq can take a look at it when he gets a chance, or add this into the future requests.
Reply With Quote
  #9  
Old 02-25-2005, 02:57 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This will go in as a feature in the next revision so don't bother with messing around with the code, unless you need it urgently.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04808 seconds
  • Memory Usage 2,291KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete