Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2008, 02:54 AM
Dorign's Avatar
Dorign Dorign is offline
 
Join Date: Jul 2004
Location: Missouri
Posts: 241
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default "Random Post Icon" possible?

When posting a new topic and/or replying to a topic, you have the option of selecting an icon. By default, "No Icon" is selected.

I was wondering if there was a simple way to have the "No Icon" renamed to "Random Icon" and have the thread automatically select a random post icon from the posticon folder.

My reasoning is almost none of my users will pick an icon, and if I remove the "No Icon" button, then all the post icons will look the same. It looks ugly on the forum.

Here's an example.



The only one using post icons is me, so there's only one selected in the image.

Is this possible? How would I go about doing this?
Reply With Quote
  #2  
Old 03-11-2008, 04:06 AM
Dorign's Avatar
Dorign Dorign is offline
 
Join Date: Jul 2004
Location: Missouri
Posts: 241
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bump
Reply With Quote
  #3  
Old 03-11-2008, 05:29 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Possible. You'll have to override the setting in newreply and choose an id at random.
Reply With Quote
  #4  
Old 03-11-2008, 05:41 AM
GameWizard's Avatar
GameWizard GameWizard is offline
 
Join Date: Apr 2004
Location: Vancouver, BC
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wouldn't it make more sense to just apply a default icon? As if you have a random one selected, it would turn into a mish mash of random colors and shit all over which will look worse than no icons.
Reply With Quote
  #5  
Old 03-11-2008, 11:43 PM
Dorign's Avatar
Dorign Dorign is offline
 
Join Date: Jul 2004
Location: Missouri
Posts: 241
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GameWizard View Post
Wouldn't it make more sense to just apply a default icon? As if you have a random one selected, it would turn into a mish mash of random colors and shit all over which will look worse than no icons.
I disagree. Being as the entire site is monochrome green in the first place, a tiny mesh of 16x16 colorful icons in one column would add enough to capture the eye. I know a lot about colors and how they're used to capture the eye because I majored in Art. Sadly, I didn't major in coding and I have no idea how to get done what I want.
Reply With Quote
  #6  
Old 03-12-2008, 08:31 AM
GameWizard's Avatar
GameWizard GameWizard is offline
 
Join Date: Apr 2004
Location: Vancouver, BC
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well then it looks like were in the same preticament. Although I am slightly more proficient in coding, but also have a good eye for design. In your case, you'll need a pretty unique script as I have never seen such a thing anywhere else, best of luck. Maybe consider requesting it in the Paid section if you're willing to dish out some cash for it.
Reply With Quote
  #7  
Old 03-13-2008, 03:49 AM
sunilvarma's Avatar
sunilvarma sunilvarma is offline
 
Join Date: Sep 2005
Location: Gainesville, FL
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's a way to do this. As this involves editing newthread.php, not everyone may like this solution.

Anyways, here's what to do:

(UPDATED) In newthread.php, FIND:
Code:
$newpost['iconid'] =& $vbulletin->GPC['iconid'];
REPLACE WITH:
Code:
if($vbulletin->GPC['iconid'] != 0){
		$newpost['iconid'] =& $vbulletin->GPC['iconid'];
	}
	else{		
		$icons_list = array();
		$iconids = $db->query_read("SELECT iconid FROM icon");
		while($row=mysql_fetch_assoc($iconids)){
			array_push($icons_list, $row);
		}
		$newpost['iconid'] = array_rand($icons_list) + 1;
	}
That should do it.

If you want to change the "No icon" text to "Random Icon" just edit the posticons template:

FIND:
Code:
$vbphrase[no_icon]
REPLACE WITH:
Code:
Random Icon
If anyone can implement this with a plugin, please show me how. And also let me know if the code is efficient.
Reply With Quote
  #8  
Old 03-13-2008, 05:32 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can hook a plugin further down the code to overwrite the variable. You also don't really need a query, just do a random number between 1-10 or something.
Reply With Quote
  #9  
Old 03-13-2008, 05:56 AM
sunilvarma's Avatar
sunilvarma sunilvarma is offline
 
Join Date: Sep 2005
Location: Gainesville, FL
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

if a posticon is deleted its ID is no longer valid right? so i used a query to get all the IDs in the table instead of generating a random number directly.

could you explain a little about hooking a plugin?
Reply With Quote
  #10  
Old 03-13-2008, 06:06 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, you could always make a setting that lets the admin list ids that they want for the random icon. As for the plugin, find a plugin before the post is submitted, but after the varuable has been initialised.
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 07:17 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.03935 seconds
  • Memory Usage 2,256KB
  • Queries Executed 13 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete