Author Topic: [Mod] Popup message when user clicks thumbnail where they have no permission  (Read 76329 times)

0 Members and 1 Guest are viewing this topic.

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Good Morning!

I´ve a question again ;)

I´ve installed the Mod and it works fine.
But how can i modify it, that the popup open when the user has no permission and/or the table-field users_coins is <10.
So I mean, if the user-group has permission, but the user has under 10 coins, then the popup opens too.

I hate my english, but i hope you understood it ;)

OK, jetzt in deutsch, ist einfacher ;)
Also ich hätte den Mod gerne so, das das popup auch erschein, wenn der user keine coins mehr hat, sprich das tabellen-feld user_coins einen Wert <10 hat.
Sprich, selbst wenn er in einer User-Gruppe ist die Zugang hat, wird noch kontrolliert, ob er genug coins hat.

Sag schonmal danke.
Gruß Marcus

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Hello!

Has nobody an idea?
I think the variable $show_link musst be modified, but i don´t know how.

Hat niemand eine idee?
Ich denke das die variable $show_link irgendwo neu definiert werden muss, aber ich weis nicht wo :(

Sage trotzdem schonmal danke.

Gruß Marcus
Gruß Marcus

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Ok, i´ve try it again.

I´ve add after this line  in the functions.php
Ich habe nach diesem Code in der functions.php

Code: [Select]
if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
    $show_link = 0;
  }
 

the following code
folgenden code eingefügt

Code: [Select]
$coin_abfrage = "SELECT user_coins FROM ".USERS_TABLE." WHERE user_id = $user_id";

if ($coin_abfrage < 10) {
$show_link = 0;
  }

But now i can´t click any thumb.
The popup opens every time.
Aber jetzt kann ich garkein Thumb mehr anklicken.
Es kommt immer das popup.

Thanks
Gruß Marcus

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Please help me :(

I´ve changed the code

Code: [Select]
$coin_abfrage = "SELECT user_coins FROM ".USERS_TABLE." WHERE user_id = $user_id";

if ($coin_abfrage < 10) {
$show_link = 0;
  }

 to

Code: [Select]
$sql = "SELECT user_coins
          FROM ".USERS_TABLE."
          WHERE user_id = $user_id";
   $result = mysql_query($sql);

if ($result < 10) {
 
$show_link = 0;
  }

but it doesn´t work too :(
Gruß Marcus

Offline havanna28

  • Newbie
  • *
  • Posts: 17
    • View Profile
Hallo

Ich glaube ich habe einen kleinen Fehler gemacht.
Ich bekomme das Popup einwandfrei angezeigt aber leider ohne Text.Hat jemand einen kleinen tipp für mich?

Dirk


Offline skidpics

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
This MOD is awesome!  Thanks!

Offline eddyman1us

  • Newbie
  • *
  • Posts: 35
    • View Profile
this mod looks very promising ...
any ideas to get it worked with 1.7.4 I tried but cudnt help !

I am also using [Mod] Star Rating + Mouseover/out + without pagereload + ip  :|

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Quote
I am also using [Mod] Star Rating + Mouseover/out + without pagereload + ip

Sigh - and if install popup message MOD in fresh gallery ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline eddyman1us

  • Newbie
  • *
  • Posts: 35
    • View Profile
even if I would have installed on an fresh 1.7.4 galllery that might now have worked as some of the codes in the original version are changed ....

I think little help from knowledgeable person could make it work for all the people having 1.74. this mod can benifit a lot of gallery admins the only thing is its aint updated and  is less known  :(

BTW my partial  functions.php ...

Code: [Select]
function get_thumbnail_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0) {
  global $site_sess, $config, $user_info, $setting;

$thumbnails_rating = $config['starrating_thumbs'];

  if (!check_media_type($media_file_name)) {
    $thumb = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".$image_name."\" />";
    }
    else {
      $file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
// ################## Start Mod Star Rating * Mouseover/ Hover * Rating without pagereload ##############
      $thumb .= rating_bar(''.$image_id.'','$thumbnails_rating_images','$rating_images','$thumbnails_rating_image_width',''.$thumbnails_rating.'','1');
// ################## End Mod Star Rating * Mouseover/ Hover * Rating without pagereload ##############
    }
  }

  if ($show_link) {
    if ($open_window) {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
  }
  return $thumb;
}





any help  :roll: !

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Quote
even if I would have installed on an fresh 1.7.4 galllery that might now have worked as some of the codes in the original version are changed ....

Even and might ?

Please try if no sure and post result.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline eddyman1us

  • Newbie
  • *
  • Posts: 35
    • View Profile
ofcourse am sure sir ! thats why seeked help here  8O

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
This is star rating MOD code ... please post in correct topic (KurtW support).
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline eddyman1us

  • Newbie
  • *
  • Posts: 35
    • View Profile
actually I posted the functions.php code which was modified due to star rating  .. I would take it as my fault anyways here is the orignal code of functions.php from fresh 1.7.4 ....


Code: [Select]

function get_thumbnail_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0) {
  global $site_sess, $config;

  if (!check_media_type($media_file_name)) {
    $thumb = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".$image_name."\" />";
    }
    else {
      $file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
    }
  }

  if ($show_link) {
    if ($open_window) {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
  }
  return $thumb;
}


I hope this is okay now !

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
You post original code and you post MOD of star rating before ... is no problem with original code.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline eddyman1us

  • Newbie
  • *
  • Posts: 35
    • View Profile
BUT I checked on the fresh install it didnt worked ....

all I can see is the original code from 1.7.1 as stated on page 1 is diffrent from the 1.7.4

one of the line is ...

from 1.7.1
Code: [Select]
if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($dummy);


while in 1.7.4 its
Code: [Select]
   if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);


I think V@no is the right person to solve this problem ..

V@no where are  you !