Author Topic: radio buttons in admin back to no every time  (Read 10152 times)

0 Members and 1 Guest are viewing this topic.

Offline DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
radio buttons in admin back to no every time
« on: September 17, 2007, 10:27:25 PM »
In the admin panel, I have some additional fields and radio buttons. The zero in db_field_definitions didn't put the radio buttons standard on no (by having the zero) but thanks to this thread http://www.4homepages.de/forum/index.php?topic=12583.0 I managed to have them standard on zero/no anyway. However, when one option (or more) is tagged as a YES in the admin panel, it goes automatically back to NO the next time I'm editing an image. What's causing this? I have version 1.7.4

Dennis

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #1 on: September 17, 2007, 10:41:12 PM »
1 - Please list all $additional_image_fields you create in includes/db_field_definitions.php file.
2 - You create fields in IMAGES_TABLE in phpmyadmin ? If yes, what is SQL command use ?
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 DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #2 on: September 18, 2007, 01:19:00 AM »
1.

$additional_image_fields['sale'] = array("Standard RF sale", "radio", 0);
$additional_image_fields['rm_photo'] = array("RM Request", "radio", 0);
$additional_image_fields['image_promotion'] = array("Promotion", "radio", 0);
$additional_image_fields['promopic'] = array("Add Promotion Pic", "radio", 0);
$additional_image_fields['price3'] = array('Price (euro)', "text", 0);

2.

I used this upload for each additional field to the database:

Code: [Select]
<?php

define
('ROOT_PATH''./');
include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'global.php');

$sql_data = array(
   
"ALTER TABLE `".IMAGES_TABLE."` ADD `promopic` tinyint (1) NOT NULL",
);

foreach (
$sql_data as $val){
if ($site_db->query($val)) {
 
  $log[$val] = "Succesfully updated Database";
}
else {
  $log[$val] = "<font color=\"red\">Error</font>";
  $error 1;
    }
}

if (!
$error) echo "Succesfully updated Database";
else echo 
"an Error occured";

?>

-------
PHP version: 4.4.6
Mysql: 4.1.22

Thanks for helping finding an answer. It's much appreciated.

Dennis, Sweden

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #3 on: September 18, 2007, 01:24:46 AM »
Ok so these 4 for int:

Quote
$additional_image_fields['sale'] = array("Standard RF sale", "radio", 0);
$additional_image_fields['rm_photo'] = array("RM Request", "radio", 0);
$additional_image_fields['image_promotion'] = array("Promotion", "radio", 0);
$additional_image_fields['promopic'] = array("Add Promotion Pic", "radio", 0);

Quote
$additional_image_fields['price3'] = array('Price (euro)', "text", 0);

What type for this one in DB ? Is say text so is varchar ? ;)
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 DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #4 on: September 18, 2007, 11:13:26 AM »
In the database
Code: [Select]
$additional_image_fields['price3'] = array('Price (euro)', "text", 0);is called: varchar.

Should I change it to text in the database?

The radio button options in the admin panel are linked to the individual settings of a price for the picture.


Dennis

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #5 on: September 18, 2007, 01:22:20 PM »
Quote
Should I change it to text in the database?

text in phpmyadmin is for textarea in HTML.

Quote
The radio button options in the admin panel are linked to the individual settings of a price for the picture.

Is update in ACP - > Setting or you create self setting page / plugin page in ACP ?
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 DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #6 on: September 18, 2007, 09:48:37 PM »
The update is in ACP. Everything works like it should, except when the photographer of the site wants to edit a picture, the options of the additional field are set to zero (no). So he has to look in his papers what the old setting of the option was, to tag it as yes again, before hitting the 'save changes' button. After the initial save, it shows right, but as soon as you click on edit and going to the picture again, they're back to zero.

Dennis

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #7 on: September 19, 2007, 01:06:58 AM »
This mean is no save right if click 'Save Changes' button. So, if go to edit images ... go to image and see view source for the additional image field ... what is say in view source of browser for this line ?
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 DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #8 on: September 19, 2007, 03:12:56 PM »
the view source for the additional fields in ACP are:

Code: [Select]
<td><p class="rowtitle">Standard RF sale</p></td>

<td><p><input type="radio" name="sale" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="sale" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow2">
<td><p class="rowtitle">RM Request</p></td>
<td><p><input type="radio" name="rm_photo" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="rm_photo" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow">
<td><p class="rowtitle">Promotion</p></td>

<td><p><input type="radio" name="image_promotion" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="image_promotion" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow2">
<td><p class="rowtitle">Add Promotion Pic</p></td>
<td><p><input type="radio" name="promopic" value="1"> Yes&nbsp;&nbsp;&nbsp;
<input type="radio" name="promopic" value="0" checked="checked"> No </p></td>
</tr><tr class="tablerow">
<td><p class="rowtitle">Price (euro)</p></td>

<td><p><input type="text" size="30" name="price3" value=""></p></td>
</tr>
<tr class="tablefooter">
<td colspan="2" align="center">
&nbsp;<input type="submit" value="   Save changes   " class="button"  onClick='showProgress()'>
<input type="reset" value="   Reset   " class="button">

I hope this is what you meant.

Dennis

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #9 on: September 19, 2007, 08:35:17 PM »
Quote
I hope this is what you meant.

Yes, good work. ;)

Now, in admin/images.php file,

find:

Quote
$sql = "UPDATE ".IMAGES_TABLE."
            SET cat_id = $cat_id, user_id = $user_id, image_name = '$image_name', image_description = '$image_description', image_keywords = '$image_keywords', image_date = $image_date, image_active = $image_active, image_media_file = '$new_name', image_thumb_file = '$new_thumb_name', image_download_url = '$image_download_url', image_allow_comments = $image_allow_comments, image_downloads = $image_downloads, image_votes = $image_votes, image_rating = '$image_rating', image_hits = $image_hits".$additional_sql."
            WHERE image_id = $image_id";
    $result = $site_db->query($sql);

add after:

Code: [Select]
var_dump($result);

Save file and go to edit image and try again. When click 'Save images' button, a line show at top of page. Please post the full debug line and I check. ;)
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 DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #10 on: September 19, 2007, 09:33:59 PM »
Here it is:

Code: [Select]
bool(true) Image edited
It's not much but I hope it's helpful. Thanks again for your time.

Dennis

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #11 on: September 19, 2007, 09:35:03 PM »
Hum ... bool true ... is mean is work for update table (+ additional image fields) ... if try on fresh folder of 4images (new database) ... is work ?
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 DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #12 on: September 20, 2007, 12:55:54 AM »
I'm not sure what you mean. Do you want me to create a whole new database?

D.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #13 on: September 20, 2007, 01:33:16 AM »
Quote
Do you want me to create a whole new database?

Yes and new fresh folder of 4images to see if same result with additional image fields ...
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 DennisRR

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: radio buttons in admin back to no every time
« Reply #14 on: September 25, 2007, 11:13:33 PM »
After having installed a fresh folder of 4images, the additional fields being set on zero in the db_field_definitions come up as yes in the ACP. I haven't implemented the solution to this as I mentioned earlier because that part worked well. But the rest seems to be okay. The options of the additional fields that I tagged yes, stay yes with the next time I edit a picture. Do I have to compare each page to see where the difference lies or do you know which file is responsible for it?

Dennis

 

Post your comments here