1
deka87
Newbb buttons
  • 2012/7/25 12:47

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Hi guys,

I am trying to edit newbb templates, but I got stuck on the following step : I can not find the way to replace those images :

Resized Image

with text links. It's not in a template file, but I cannot find it in a .php too.

Would appreciate your help.

Deka87

2
Mamba
Re: Newbb buttons
  • 2012/7/25 13:07

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


a) Which version? 3.08 or 4.3?

b) You can always right-click and find out the name of the image, and then search in the code. In some modules they use the extension (like .png), but the name comes from a function (like "edit"), so you might look for it too.

c) but changing images is easy - just look for them in the subdirectories. Most of the time they are under /images.

For Newbb 4.3 the English images are in:

newbb/images/imagesets/default/english

There also images for German and Chinese languages.

For Russian, just create a new directory for /russian, and then add new images there. I believe, Newbb will take the images based on used language.



Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
deka87
Re: Newbb buttons
  • 2012/7/25 15:54

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Mamba, thanks for your reply.

I use 3.08. You got me a little wrong, I don't want to replace images with other images, I just need text links (like you have here on xoops.org like Reply | Quote | Top ). I cam across this
$thread_buttons['edit']['image'] = newbb_displayImage($forumImage['p_edit'], _EDIT);
            
$thread_buttons['edit']['link'] = "edit.php?forum=" .$post->getVar('forum_id') . "&topic_id=" $post->getVar('topic_id');
            
$thread_buttons['edit']['name'] = _EDIT;


in viewpost php. Thats a big array used to display the images I guess. I whatever I do it doesn't change a thing.

4
Anonymous
Re: Newbb buttons
  • 2012/7/25 18:39

  • Anonymous

  • Posts: 0

  • Since:


I am following this thread with interest, as I also like to ged rid of those buttons.

The option to not use button would also be a nice addition to the admin settings!

5
irmtfan
Re: Newbb buttons
  • 2012/7/26 3:59

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Quote:


For Newbb 4.3 the English images are in:

newbb/images/imagesets/default/english



The above path is used for 3.08
In 4.3 the imagesets feature is removed but another best and full customization feature for images is introduced and available.
Quote:

* Priority for path per types:
* NEWBB_ROOT - IF EXISTS XOOPS_THEME/modules/newbb/images/, TAKE IT;
* ELSEIF EXISTS XOOPS_THEME_DEFAULT/modules/newbb/images/, TAKE IT;
* ELSE TAKE XOOPS_ROOT/modules/newbb/templates/images/.
* types:
* button/misc - language specified;
* //indicator - language specified;
* icon - universal;
* mime - universal;
*/

look here for detail information for newbb 4.3 image customization: https://xoops.org/modules/newbb/viewtopic.php?post_id=347900

As for "text links" instead of "images", i can not see any easy way for doing it.
I will take a deep a look in newbb 3.08 and 4.3 codes when i find some times but im agree that it is very needed feature.

deka87:
I found a solution for you. (It is a temporary solution)
It is works in 4.3 and i think it will be worked in 3.08 (i will test later)

firstly you should find all "newbb_displayImage" and change the display to false:
for example most of them are in newbb/class/post.php
change this:
$thread_buttons['edit']['image'] = newbb_displayImage('p_edit'_EDIT);

with this:
$thread_buttons['edit']['image'] = newbb_displayImage('p_edit'_EDIT,false);


Then go to newbb/class/icon.php and change assignImage function:

change this:
function assignImage($image$alt ""$extra "")
    {
        
$this->setImage($image$alt$extra);
        return 
true;
    }

with this:
function assignImage($image$alt ""$extra "")
    {
        
$this->setImage($image$alt$extra);
        return 
$alt;
    }

Hope you can test in 3.08 sooner than me.
Hope newbb developer set a yes/no in newbb configuration for displaying images.

edit:

I found a better solution for the above. (still is not final)
instead of changing all "newbb_displayImage" just go to newbb/include/functions.render.php and in newbb_displayImage function change $display default value from true to false like this:
change this:
function newbb_displayImage($image$alt ""$display true$extra "class='forum_icon'")

    
$icon_handler newbb_getIconHandler(); 
    if (empty(
$display)) { 
        return 
$icon_handler->assignImage($image$alt$extra); 
    } else { 
        return 
$icon_handler->getImage($image$alt$extra); 
    } 
}

with this:
function newbb_displayImage($image$alt ""$display false$extra "class='forum_icon'")

    
$icon_handler newbb_getIconHandler(); 
    if (empty(
$display)) { 
        return 
$icon_handler->assignImage($image$alt$extra); 
    } else { 
        return 
$icon_handler->getImage($image$alt$extra); 
    } 
}

6
irmtfan
Re: Newbb buttons
  • 2012/7/26 7:09

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Ok i found the final solution for this request.
How to change all image buttons in newbb with text links in 3 steps.

1- in newbb/class/icon.php and change assignImage function to return the alt key:
change this:
function assignImage($image$alt ""$extra ""
    { 
        
$this->setImage($image$alt$extra); 
        return 
true
    }

with this:
function assignImage($image$alt ""$extra ""
    { 
        
$this->setImage($image$alt$extra); 
        return 
$alt
    }


2- in newbb/include/functions.render.php and in newbb_displayImage function change to customize $display value:
change this:
function newbb_displayImage($image$alt ""$display true$extra "class='forum_icon'")
{  
    
$icon_handler newbb_getIconHandler();  
    if (empty(
$display)) {  
        return 
$icon_handler->assignImage($image$alt$extra);  
    } else {  
        return 
$icon_handler->getImage($image$alt$extra);  
    }  
}

with this to add the custom configuration:
function newbb_displayImage($image$alt ""$display true$extra "class='forum_icon'")
{
    
$icon_handler newbb_getIconHandler();
        global 
$xoopsModuleConfig;
        if (!empty(
$xoopsModuleConfig['display_text_links'])){
            
$display=false;
        }
    if (empty(
$display)) {
        return 
$icon_handler->assignImage($image$alt$extra);
    } else {
        return 
$icon_handler->getImage($image$alt$extra);
    }
}

3- then you can define the configuration in newbb/include/plugin.php
// Display text links instead of image buttons for edit, reply, .... set true or false
$customConfig["display_text_links"] = true;

if you dont define the above "display_text_links" config (didnt do the 3 step) or set it to false the images will be displayed.
IMO the above is final solution for this issue.
just as always all newbb/include/plugin.php configurations need to be added to newbb preferences.

deka87:
please forget my last post and do the above for 3.08 and let us know the result.

7
deka87
Re: Newbb buttons
  • 2012/7/26 10:19

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Quote:

Ok i found the final solution for this request.
How to change all image buttons in newbb with text links in 3 steps.


irmtfan, thanks for your work on this!

However, with my newbb 3.08 I still have the images left after the 3 steps.

Quote:

just as always all newbb/include/plugin.php configurations need to be added to newbb preferences.


is that what I also had to do?

thanks

8
Mamba
Re: Newbb buttons
  • 2012/7/26 11:55

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
I am following this thread with interest, as I also like to ged rid of those buttons.

I do like buttons . They are visually more distinct, and therefore easier to find, as all the GUI research shows. Of course, we can debate how the buttons should look like, but that's a different story.

For the time being, the best way to get rid of buttons in 3.08 is to switch to 4.3

But I hope that in 4.3 we'll have the option to use buttons or text. I wouldn't like to get rid of the buttons. Actually, when I think about it, I believe that in an earlier version of NewBB 4.x we had buttons, so we need to get them back, even if only as an option.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

9
Anonymous
Re: Newbb buttons
  • 2012/7/26 12:22

  • Anonymous

  • Posts: 0

  • Since:


Quote:
Actually, when I think about it, I believe that in an earlier version of NewBB 4.x we had buttons, so we need to get them back, even if only as an option.


The nlxoops forum uses newbb 4.3, including buttons! So you want to say it is an accident the xoops.org forum shows text instead of buttons???

10
irmtfan
Re: Newbb buttons
  • 2012/7/27 1:57

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


deka87:
The hack is perfectly worked on 4.3 but I didnt test on 3.08 yet. I think there are some differences. I will take a look.

Mamba:
I believe you did a great hack in xoops.org templates after upgrading to 4.3 to show text links.
4.3 shows buttons in all installations by default and one can find it easily.
Just there was no easy yes/no option to show text links instead of buttons that i solved it in this topic.
Now by using this hack, 4.3 is totally optional. you can select buttons or text links. if you select buttons you can fully customized them for each theme one by one without any touch to modules/newbb or core just can be done in your theme.


Login

Who's Online

407 user(s) are online (288 user(s) are browsing Support Forums)


Members: 0


Guests: 407


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits