Please or Register to create posts and topics.

Use WordPress media gallery for admin users

Hi @asgaros it,s posible to use WordPress media gallery only for Admin user?

If Admin = can use WordPress media gallery inside topics.

AND

if AdminWYSIWYG HTML Editor else = Minimal Text Editor

Thanks, every thing working fine on my site 🙂

Hello @adnan

You can try to add the following code to your themes functions.php file:

function change_editor_settings($settings) {
  if (is_super_admin()) {
    $settings['media_buttons'] = true;
 	} else {
    $settings['quicktags'] = true;
  }

  return $settings;
}
add_filter('asgarosforum_filter_editor_settings', 'change_editor_settings');

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on June 13, 2019, 4:37 pm

Hello @adnan

You can try to add the following code to your themes functions.php file:

function change_editor_settings($settings) {
  if (is_super_admin()) {
    $settings['media_buttons'] = true;
 	} else {
    $settings['quicktags'] = true;
  }

  return $settings;
}
add_filter('asgarosforum_filter_editor_settings', 'change_editor_settings');
  1. function change_editor_settings($settings) {
  2. if (is_super_admin()) {
  3. $settings[‘media_buttons’] = true;
  4. } else {
  5. $settings[‘quicktags’] = true;
  6. }
  7. return $settings;
  8. }
  9. add_filter(‘asgarosforum_filter_editor_settings’, ‘change_editor_settings’);
function change_editor_settings($settings) {
  if (is_super_admin()) {
    $settings['media_buttons'] = true;
 	} else {
    $settings['quicktags'] = true;
  }

  return $settings;
}
add_filter('asgarosforum_filter_editor_settings', 'change_editor_settings');

 

Just try the code but noting happen

  1. if (is_super_admin()) {   i change to if(is_admin() {  because i am admin not super_admin (try both but nothing happen).
Uploaded files:
  • Captura-de-pantalla-2019-06-13-a-las-17.21.31.png

Hello @adnan

You have to use the is_super_admin() function, because the is_admin() function cannot be used for this. If you are a normal WordPress administrator, it should work fine.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on June 14, 2019, 3:47 pm

Hello @adnan

You have to use the is_super_admin() function, because the is_admin() function cannot be used for this. If you are a normal WordPress administrator, it should work fine.

With is_super_admin() topic page not load for Admin users.

Uploaded files:
  • Captura-de-pantalla-2019-06-14-a-las-16.44.20.png

Hello @adnan

I tested the code again and its working fine so far. Can you check your browser-console in Google Chrome by pressing CTRL + SHIFT + J? Do you see any error in the Console tab there?

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hi, @asgaros Plz check the screenshot. only see these errors when i use the given code.

Uploaded files:
  • Captura-de-pantalla-2019-06-20-a-las-11.39.30.png

@adnan

It seems that some scripts are not loaded correctly. Please try to disable some plugins which block loading of certain scripts like autoptimize.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!