vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Posticons exlusive to forums. NO STYLE editing!!! (https://vborg.vbsupport.ru/showthread.php?t=81715)

tehcake 05-18-2005 09:00 PM

Posticons exlusive to forums. NO STYLE editing!!!
 
This has been done before, but I've yet to see it released here. I was desperate to have this for my forums which has a lot of posticons.

This hack allows you to make posticons useable in only forums you specify. I'm no PHP expert, and I find it amazing how I pulled this off (Had a little help from someone to get it working correctly.), so you won't be able to set the settings through admincp yet. Instead, you have to manually do some changse in your MySQL database for each posticon.

Step 1 MySQL
First, you'll have to go to the icon table in your MySQL database. Create a field called iconforums in the table. Then edit each posticon (phpMyAdmin you'll have to click on the BROWSE tab in the table to edit the fields.), add the forumids to the iconforums field, seperating each forumid with only a comma.

Step 2
Now you'll have to edit your includes/functions_newpost.php.
FIND
Code:

                SELECT iconid, iconpath, title
REPLACE WITH
Code:

                SELECT iconid, iconpath, title, iconforums

FIND
Code:

        while ($icon = $DB_site->fetch_array($icons))

        {

ADD BELOW
Code:

        $forumid = $foruminfo[forumid];
                $forums = explode(',',$icon[iconforums]);
                if (in_array($forumid,$forums))
                {

FIND
Code:

                        eval('$posticonbits .= "' . fetch_template('posticonbit') . '";');
ADD BELOW
Code:

}
FINISH! Enjoy you're cleaner forums. :)

Blackbeard 05-19-2005 04:47 AM

Sorry stupid Q but do you have a screenie of this one please.

Jenta 05-19-2005 04:59 AM

you know when u create a thread or post?
u have the icons u can use for that thread or post

this makes it so some icons will only show up in certain forums and hence can only be used in those forums

i have the perfect use for this, a coding forum where there are icons based on what code your thread is about
i find people using those icons in off topic :/

thanks

Oblivion Knight 05-19-2005 05:25 AM

Is it possible to do this per style instead of using replacements (which is what I'm currently doing)? :)

Jenta 05-19-2005 05:32 AM

perhaps, i have the wrong format for iconforums?
nothing is showing up

perhaps its this line?
PHP Code:

  `iconforumsvarchar(100NOT NULL default ''


PHP Code:

CREATE TABLE `icon` (
  `
iconidsmallint(5unsigned NOT NULL auto_increment,
  `
iconforumsvarchar(100NOT NULL default '',
  `
titlevarchar(100NOT NULL default '',
  `
iconpathvarchar(100NOT NULL default '',
  `
imagecategoryidsmallint(5unsigned NOT NULL default '0',
  `
displayordersmallint(5unsigned NOT NULL default '1',
  
PRIMARY KEY  (`iconid`)
TYPE=MyISAM AUTO_INCREMENT=22 ;

-- 
-- 
Dumping data for table `icon`
-- 

INSERT INTO `iconVALUES (1'2,3,4,5,6,7,8,10,11,12,13,14,15''News''images/icons/icon1.gif'41);
INSERT INTO `iconVALUES (2'2,3,4,5,6,7,8,10,11,12,13,14,15''Read This''images/icons/icon2.gif'41);
INSERT INTO `iconVALUES (3'2,3,4,5,6,7,8,10,11,12,13,14,15''Idea''images/icons/icon3.gif'221);
INSERT INTO `iconVALUES (4'2,3,4,5,6,7,8,10,11,12,13,14,15''Important!''images/icons/icon4.gif'230);
INSERT INTO `iconVALUES (5'2,3,4,5,6,7,8,10,11,12,13,14,15''Question''images/icons/icon5.gif'220);
INSERT INTO `iconVALUES (6'2,3,4,5,6,7,8,10,11,12,13,14,15''Cool''images/smilies/cool.gif'210);
INSERT INTO `iconVALUES (7'2,3,4,5,6,7,8,10,11,12,13,14,15''Smile''images/smilies/smile.gif'26);
INSERT INTO `iconVALUES (8'2,3,4,5,6,7,8,10,11,12,13,14,15''Angry''images/smilies/mad.gif'29);
INSERT INTO `iconVALUES (9'2,3,4,5,6,7,8,10,11,12,13,14,15''Unhappy''images/smilies/frown.gif'28);
INSERT INTO `iconVALUES (10'2,3,4,5,6,7,8,10,11,12,13,14,15''Big Smile''images/smilies/biggrin.gif'210);
INSERT INTO `iconVALUES (11'2,3,4,5,6,7,8,10,11,12,13,14,15''Red face''images/smilies/redface.gif'210);
INSERT INTO `iconVALUES (12'2,3,4,5,6,7,8,10,11,12,13,14,15''Wink''images/smilies/wink.gif'27);
INSERT INTO `iconVALUES (13'2,3,4,5,6,7,8,10,11,12,13,14,15''Thumbs down''images/icons/icon13.gif'225);
INSERT INTO `iconVALUES (14'2,3,4,5,6,7,8,10,11,12,13,14,15''Thumbs up''images/icons/icon14.gif'226);
INSERT INTO `iconVALUES (15'2,3,4,5,6,7,8,10,11,12,13,14,15''Very Important!''images/buttons/report.gif'41);
INSERT INTO `iconVALUES (16'2,3,4,5,6,7,8,10,11,12,13,14,15''Extremely Important!''images/icons/important.gif'44); 

any ideas on the proper row structure?

ps, heres the code
as u can see its exactly as ur instructions say...

PHP Code:

    // original SELECT iconid, iconpath, title
    
$icons $DB_site->query("
        SELECT iconid, iconpath, title, iconforums
        FROM " 
TABLE_PREFIX "icon AS icon
        WHERE imagecategoryid NOT IN (0
$badcategories)
        ORDER BY imagecategoryid, displayorder
    "
);

    if (!
$DB_site->num_rows($icons))
    {
        return 
false;
    }

    
$numicons 0;
    
$show['posticons'] = false;

    while (
$icon $DB_site->fetch_array($icons))
    {
    
// hack 
    
$forumid $foruminfo[forumid];
        
$forums explode(',',$icon[iconforums]);
        if (
in_array($forumid,$forums))
        {
    
// hack end
        
$show['posticons'] = true;
        if (
$numicons == AND $numicons != 0)
        {
            
$posticonbits .= "</tr><tr><td>&nbsp;</td>";
        }

        
$numicons++;

        
$iconid $icon['iconid'];
        
$iconpath $icon['iconpath'];
        
$alttext $icon['title'];
        if (
$seliconid == $iconid)
        {
            
$iconchecked HTML_CHECKED;
            
$selectedicon = array('src' => $iconpath'alt' => $alttext);
        }
        else
        {
            
$iconchecked '';
        }

        eval(
'$posticonbits .= "' fetch_template('posticonbit') . '";');
        
// hack
        
}
        
// hack end

    



boo.3 05-19-2005 09:37 AM

screen shot?

tehcake 05-19-2005 01:05 PM

Sorry Jenta, but I'm not really a PHP/MySQL person, so I went into phpMyAdmin and did it all by hand instead of using a query. I don't know if it's the problem, but maybe it's the CREATE part because the icon table already exists?

Allan 05-19-2005 02:52 PM

Not bad yes, but could you put instruction in a .txt file, please

You have no image has to be proposed with this hack also ?

Jenta 05-19-2005 03:44 PM

Quote:

Originally Posted by tehcake
Sorry Jenta, but I'm not really a PHP/MySQL person, so I went into phpMyAdmin and did it all by hand instead of using a query. I don't know if it's the problem, but maybe it's the CREATE part because the icon table already exists?

the create code is just my dump of the table, i didnt use it to actually add ur row
its only to show the rows and what is in each



PHP Code:

`iconforumsvarchar(100NOT NULL default ''

this is the row you say to create
can you look at yours and see if its the same?

Jenta 05-19-2005 03:47 PM

argh, no automerge double post :rolleyes:

anyways....

for those wanting an image, heres one straight from this forum
these are post icons
this hack lets u set which forum each post icon will appear in
its the same as setting an icon category that only certain usergroups can use but its forum bases instead of usergroup based


here's a scenario that might help some understand

lets say you run a decorating forum with different forums

one forum is for gardens and stuff
you have post icons like - rakes and wheelbarrows

then you have another forum about kitchens
you have icons like - cups and refrigerators

then u have a forum where people talk about everyday life - off topic
u dont want the cups, refrigirators, rakes or wheelbarrrow appearing there

opps, just say he added some icons
nm :)


All times are GMT. The time now is 03:00 PM.

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.02620 seconds
  • Memory Usage 1,797KB
  • 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
  • (6)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)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