Welcome, Guest. Please Login or Register.
May 14, 2025, 06:46:55 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Disabling image-posting, conditionally « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Disabling image-posting, conditionally  (Read 1172 times)
Snoader
Noobie
*
Posts: 28


No guts, no glory.

WWW
Disabling image-posting, conditionally
« on: July 30, 2003, 11:02:12 AM »
Reply with quote

YaBB SE Version: 1.5.4
PHP Version:
MySQL Version:
Server Platform: Unix, Linux, or BSD
Link to Forum:

Problem Description:
I wanted to disable the possibility for user to post images, so  I adapted function doparsecodesmilies in Subs.mod.

I replaced

'<img src="\\1" alt="" border="0" />',
'<img src="\\3" alt="" border="0" width="\\1" height="\\2" />',
'<img src="\\3" alt="" border="0" width="\\2" height="\\1" />',


with

($settings[7] == 'Administrator' || $settings[7] == 'Global Moderator') ? '<img src="\\1" alt="" border="0" />' : '',
($settings[7] == 'Administrator' || $settings[7] == 'Global Moderator') ? '<img src="\\3" alt="" border="0" width="\\1" height="\\2" />' : '',
($settings[7] == 'Administrator' || $settings[7] == 'Global Moderator') ? '<img src="\\3" alt="" border="0" width="\\2" height="\\1" />' : '',


But unfortunately it seems that the value of $settings[7] resolves to '', i.e. when an Administrator or GM tries to post an image, the image-tags are removed from the message.

Is there any other way to allow Admins and GMs to post images, while normal users cannot?
Logged

[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Disabling image-posting, conditionally
« Reply #1 on: July 30, 2003, 05:49:58 PM »
Reply with quote

Yuo may have to global $settings.

-[Unknown]
Logged
Snoader
Noobie
*
Posts: 28


No guts, no glory.

WWW
Re:Disabling image-posting, conditionally
« Reply #2 on: July 31, 2003, 07:48:05 AM »
Reply with quote

Or move the code to another function :)

I've put the following code in preparsecode:

if (!(settings[7] == 'Ádministrator' || settings[7] == 'Global Moderator'))
   {
      $message = str_replace("[img".$searchfor."[/img]","",$message);
      $message = str_replace("[IMG".$searchfor."[/IMG]","",$message);
   }
Logged

Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Disabling image-posting, conditionally « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.059 seconds with 21 queries.