Author Topic: [MOD] - Show edit and delete link in new images of index page  (Read 13445 times)

0 Members and 1 Guest are viewing this topic.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
[MOD] - Show edit and delete link in new images of index page
« on: October 03, 2007, 03:05:46 AM »
This show [edit] and [delete] in new images table of index page for details image (same in details for admin).

In index.php file,

find:

Quote
while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images .= $site_template->parse_template("thumbnail_bit");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

replace:

Code: [Select]
while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";     
    }
   
    $is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 1 : 0;
    if ($user_info['user_level'] == ADMIN) {
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&image_id=".$image_row['image_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&image_id=".$image_row['image_id']))."\" target=\"_blank\">".$lang['delete']."</a>";       
    } elseif ($is_image_owner) {
        $admin_links .= ($config['user_edit_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= ($config['user_delete_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\">".$lang['delete']."</a>";
        unset ($is_image_owner);
    }  
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">" . ((isset($admin_links)) ? $admin_links  : "") . "\n";

    show_image($image_row);   

    $new_images .= $site_template->parse_template("thumbnail_bit");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
    unset ($admin_links);
  } // end while
« Last Edit: October 03, 2007, 10:28:04 PM by thunderstrike »
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 thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] - Show edit and delete link in new images of index page
« Reply #1 on: October 03, 2007, 10:28:22 PM »
I add image owner in MOD now.
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 ?

Rembrandt

  • Guest
Re: [MOD] - Show edit and delete link in new images of index page
« Reply #2 on: July 23, 2011, 07:32:38 AM »
Hi!

works!

1.)replace the code above with these, and they can put the "admin link" in the "thumbnail_bit" where ever you want:

  
while ($image_row $site_db->fetch_array($result)){
    if (
$count == 0) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
      
$new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";      
    }
    
$new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
    
$admin_links="";
    
$is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 0;
    if (
$user_info['user_level'] == ADMIN) {
        
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&image_id=".$image_row['image_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&image_id=".$image_row['image_id']))."\" target=\"_blank\">".$lang['delete']."</a>";        
    } elseif (
$is_image_owner) {
        
$admin_links .= ($config['user_edit_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\">".$lang['edit']."</a>&nbsp;";
        
$admin_links .= ($config['user_delete_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\">".$lang['delete']."</a>";
        unset (
$is_image_owner);
    }

    
$new_images .=  $site_template->register_vars("admin_links"$admin_links);
    
show_image($image_row);    

    
$new_images .= $site_template->parse_template("thumbnail_bit");
    
$new_images .= "\n</td>\n";
    
$count++;
    if (
$count == $config['image_cells']) {
      
$new_images .= "</tr>\n";
      
$count 0;
    }
    unset (
$admin_links);
  } 
// end while


2.) now you can write  "{admin_links}" where ever you want in your templates/yourTemplates/thumbnail_bit (example):
Code: [Select]
<!-- you wish detail page in a small javascript open window, use {thumbnail_openwindow} -->
{thumbnail}<br />
<b>{image_name}</b> {if image_is_new}<sup class="new">{lang_new}</sup>{endif image_is_new} ({user_name_link})
<br />
<a href="{cat_url}">{cat_name}</a><br />
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />
{lightbox_button}<br>
{admin_links}


mfg Andi

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] - Show edit and delete link in new images of index page
« Reply #3 on: October 27, 2014, 12:21:19 PM »
admin_links is not working for me. I can't see EDIT or ERASE buttons on images pages.

Any suggestion?

Rembrandt

  • Guest
Re: [MOD] - Show edit and delete link in new images of index page
« Reply #4 on: October 27, 2014, 12:34:37 PM »
it works

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] - Show edit and delete link in new images of index page
« Reply #5 on: October 27, 2014, 12:37:36 PM »
Sorry, I didn't explain me well.
For me, the edit and erase buttons on image pages are not appearing since some weeks ago.