Hi, just wondering how to use an image instead of the "Post New Topic" link in my forums on my drupal 4.7 site?

I'm wanting to make an eye catching "Post New Topic" button, for people more familiar with common forums with New Discussion image buttons etc - but I'm not sure how to add it to forum.module?

Thanks

Comments

JonathanDStopchick’s picture

You could edit the forum.module file on line 890, and change the text from "Post New Topic" to your image code. Though I havent actually tested this myself.

Me I'm dishonest, and a dishonest man you can always trust to be dishonest. Honestly it's the honest ones you have to watch out for, you never can predict if they're going to do something incredibly stupid. -Jack Sparrow

mediafrenzy’s picture

Tried that, and it didn't work - it just used the IMG tag code as a text link...

ckeo’s picture

Ive been playing with the forum module for the last couple of days making it look like phpbb forums...
And i must say... so far if you look at the one im working on and the original phbb theme... its exact except for some little features... including the one you mentioned and i have it working.

Actually... what i have working is the icon of the last column that takes you to the latest post... but it should work for what your doing also.

Craig.

ckeo’s picture

replace this line :

     $output .= '<li>'. l(t('Post new forum topic.'), "node/add/forum/$tid") .'</li>';

with this line:

   $output .=  l('<img class="icon" src="'. base_path() .                  
      path_to_theme().'/templates/subza/images/lang_english/post.gif" />' 
      ,"node/add/forum/$tid"
      ,NULL, NULL, NULL, NULL, TRUE);

Of course... replace the section: /templates/subza/images/lang_english/post.gif
with the path to the button from within your theme directory.

If you want to see what my forum looks like.... goto www.newfoundnews.com
and you need to login and select the aquasoft2 theme to see the way im changing my forums to be.

(its a work in progress... but looking good.)

Craig.

mediafrenzy’s picture

Oh great stuff! I'll check that out when I get home tonight. It's running 4.7 presumably?

Thanks heaps!

ckeo’s picture

im running 4.7.3.

Craig.

sepeck’s picture

one of the css image replacement tricks?
http://www.webreference.com/programming/css_flicker/

That way you are not modifying Drupal Core files that will inevitably suffer from upgrade hell.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

ckeo’s picture

besides... i overided the function in my template file.

you cant learn how to build something if you cant take it apart.

Craig.

by the way... thanks for the link.... i might use that for my primary link icons.

sepeck’s picture

Your earlier posts you suggest editing the forum module itself which is an extremely bad idea in terms of upgradability and habit. Overriding the function is of course the good way.

Of course using only text image for link with no fallback to text, that relies on you knowing your userbase isn't vision impaired, etc and is your site's design desician ....

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

ckeo’s picture

I know I need it to fall back to text... but believe me for a beginner trying to figure out how to get the image there in the first place was a big deal for me. And i had just got it to do that about an hour before i saw this thread.

And.... for the record... i have done what ive done so far without posting any questions here asking how to do it, I spent a couple of weeks reading the handbooks, the forum posts, and looking at the code... (which is what it takes, as far as im concerned).
so... i think its progress for a nubie like me to be a ble to accomplish these things.

But i do welcome constructive criticizim.

Craig.

And actually... i didnt suggest editing the forum module... i gave the op the method to accomplish his/her task in the manner they asked for it. lol... i maybe new to drupal and web stuff..... but i have coded in other languages.

sepeck’s picture

You're right, it was the first guy in the thread who suggested the edits..... heh. My bad there.

Questions are fine. Just trying to help point out issue avoidance for folks new to using Drupal for upgrades and such. I sincerly understand the intial learning curve. There are people using Drupal for a long time learning new/different sometimes better ways to use Drupal all the time. It's not just a newbie thing.

It's a continuous learning thing. Of course, once you get past a certain point you pick up cool tricks and neat ways and combinations to do things that just hadn't occured to you until you got this spiffy toolset called Drupal to play with.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

ckeo’s picture

im loving it so far.... there is alot to play with and learn.
I had wanted to try building a website for a few years but never did for lack of tools and when i started looking into it again and did some googling im pleased to say that drupal was my first choice and it appears to have been a wise one. I find most of the core code logical and easy to follow... tho... im still learning how some of the php semantics work. eventually i'll be a guru.

Craig

mediafrenzy’s picture

That's an interesting idea - I am a CSS n00b, but would certainly like to learn a skill like this - it looks very useful. If at all possible I *would* like to keep as far away as possible from "upgrade hell"! Oh the wailing and gnashing of teeth!

ckeo’s picture

well as far as i can see....
there wont be an significant changes to the forum module anytime soon.

sepeck’s picture

Functionally, 4.7 forum module is frozen. This does not mean that in order to fix a bug/issue/etc some future point release won't change something. The method to fix an issue has often affected many modules so editing forum module for 4.7.3 may seriously affect an upgrade to 4.7.4.

An example was the change between 4.6.3 to 4.6.4 to account for XSS issue's changed behavior of several modules and broke a hack (1) I had done for a friend.

Now, if you wish to see functionality in forum module change for 4.8/5.0, then by all means submit patches. Now is the time to do it. Freeze is in three weeks so start early to get the review and feedback needed to get code in.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

ckeo’s picture

im doing what im doing in order to learn.
You have to understand that im not familiar with php, html, or css and therefore im not in a position to submit patches... im still learning how the forum module works. But bit by bit i will tear it apart and rebuild it... thats how i learn, and in the process, if i can develop some extensions or make something more flexible... then i will definately submit patches, tho.... from things ive read in the forums here.... patches to the forum module are not readily accepted.

Craig.