XF 2.1 how to hide the Attach files button on Post thread page but retain its function (which is also used by Drop image)?

gogo

Well-known member
For some nodes I would like users to be able to upload images only, but the Attach files button include too many file types. So I would like to let them upload images by using the Drop image menu only. I tried to remove the Attach files button from message.macro but the Drop image menu will also be gone.
 
You could hide the button by creating a template modification for template helper_attach_upload, macro upload_link
If you only want to remove it for thread posts and not conversations then you can include a if/else statement that checks for $type == 'post'
Then add style="visibility:hidden" to the end of the button code.
 
You could hide the button by creating a template modification for template helper_attach_upload, macro upload_link
If you only want to remove it for thread posts and not conversations then you can include a if/else statement that checks for $type == 'post'
Then add style="visibility:hidden" to the end of the button code.

Thanks for your reply.

I modified helper_attach_upload and it becomes this:

1587751127324.webp

The button is gone but the space is still clickable and will open the normal file selection window.

The second thing is where is macro upload_link? Thanks.
 
related... simply curious... what code would hide the drop image tab in the insert image button popup! thanks!


I have no idea about the codes but there's a paid add-on doing so.

 
You could hide the button by creating a template modification for template helper_attach_upload, macro upload_link
If you only want to remove it for thread posts and not conversations then you can include a if/else statement that checks for $type == 'post'
Then add style="visibility:hidden" to the end of the button code.
Try style="display:none"
upload_link is the first section of the template where you are making the changes.

These work wonderfully for my purpose! Thanks a lot!
 
You could hide the button by creating a template modification for template helper_attach_upload, macro upload_link
If you only want to remove it for thread posts and not conversations then you can include a if/else statement that checks for $type == 'post'
Then add style="visibility:hidden" to the end of the button code.
I realize this thread is older, but I need help making this solution work. My server host must have security settings that are preventing the "attach files" button from working correctly and now that we're using XF 2 our members keep trying to use the attach files button even though it never completes the process, and I'm tired of repeating myself to those who can't/won't read my announcements that it is not functioning.

I tried the suggested template modification but I'm not very experienced with code at all and probably did not do it right as nothing changed. I'd like to make the button disappear so they'll look at the toolbar above and use the "insert image" button that actually works. I just need someone to please break down the addition of the code mentioned in more detail so my old, uninformed brain can figure out how to implement it. Thanks in advance.
 
I realize this thread is older, but I need help making this solution work. My server host must have security settings that are preventing the "attach files" button from working correctly and now that we're using XF 2 our members keep trying to use the attach files button even though it never completes the process, and I'm tired of repeating myself to those who can't/won't read my announcements that it is not functioning.

I tried the suggested template modification but I'm not very experienced with code at all and probably did not do it right as nothing changed. I'd like to make the button disappear so they'll look at the toolbar above and use the "insert image" button that actually works. I just need someone to please break down the addition of the code mentioned in more detail so my old, uninformed brain can figure out how to implement it. Thanks in advance.

My css code from above will do exactly that

Just copy the code from above

Then go to admin panel and type extra.less into the search box and select it from the drop down.

Paste the code at the bottom and hit save and it should work.
 
My css code from above will do exactly that

Just copy the code from above

Then go to admin panel and type extra.less into the search box and select it from the drop down.

Paste the code at the bottom and hit save and it should work.
Thanks! It worked perfectly. I was trying the other method shown further above (why I quoted the post by Bespoke, which I could not get to work. These things are scary for me, the last thing I want to do is blow up my XF installation. Thanks again. (y)
 
Well, I just found out it works on replies to posts, but not on new posts in a new thread. The attach files button is still visible when starting a new thread. My concern about the other method shown further above (in the template with helper_attach_upload, macro upload_link) was that I was not sure where to paste it in. I tried the bottom as you suggested with your answer but it did nothing.
 
Top Bottom