Edit link bug

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-15-2009, 02:46 AM
New Pligger
 
Join Date: Nov 2008
Posts: 2
Pligg: 9.9.5
Template : Hot News

I don't know for sure if this is a bug, here is what i found :

When I edit the link, after click submit, the link became with a number after this (To solve the duplicate URL)
For examples :
Before edit, the link is :
linkraovat.com/trang-suc-my-pham-phu-kien/trang-suc-nam-soi-bac/

But after update or edit the link, it is :
linkraovat.com/trang-suc-my-pham-phu-kien/trang-suc-nam-soi-bac-1

This is not good for google to index the site, or for those who copy the link for other user to see the story.

I think we need to update the function makeUrlFriendly in Utils.php. We need to check if there is any story that is not the same id and have the same url like the story we edit, we just changed, if no, just leave it alone.

So this is what i have changed :

1/ Add a new function in Utils.php called function
makeUrlFriendlyEdit($input,$id)
2/ This function is copied exactly from the function makeUrlFriendly with a modification in the last when checking duplicate.
PHP Code:

   
if(function_exists('utils_makeUrlFriendlyEdit')) {
        
$output utils_makeUrlFriendly($output,$id);
    }
   
   
//  check to see if the story title already exists. If so, add an integer to the end of the title
    
$n $db->get_var("SELECT count(*) FROM " table_links " WHERE link_title_url like '$output%' and link_id <> '$id'" );
    if (
$n 0) {
        return 
$output "-$n";}
    else {
        return 
$output;
     } 
3/ In the editlink.php, we search for the function makeUrlFriendly($linkres->title) and replace with makeUrlFriendlyEdit($linkres->title,$linkres->id);

I tested it on my site, it worked okie. If you found something that is not good, please tell me know.

Thanks for your reading

P/s : Sorry for my not good English

Visit my site : Link Rao Vặt / Link HOT

Last edited by cucat; 01-15-2009 at 05:33 AM.
Reply With Quote
  #2 (permalink)  
Old 01-21-2009, 05:44 PM
Casual Pligger
Pligg Version: 1.1.5
Pligg Template: default
 
Join Date: Jan 2008
Posts: 38
good job also and i fix this problem with your tutorial
Reply With Quote
  #3 (permalink)  
Old 01-21-2009, 07:58 PM
Pligg Donor
 
Join Date: Jul 2007
Posts: 286
Works like charm. Thanks
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Special Advertising Add-On for banners Tutorial AnAlienHolakres3 Questions and Comments 19 10-25-2009 08:56 AM
Better Submit and Edit Link pages AnAlienHolakres3 Questions and Comments 3 07-24-2008 09:44 AM
edit story and outgoing link returns blank page crusty Questions and Comments 0 08-23-2007 03:30 PM
Edit comment link not working Dubai Questions and Comments 18 01-24-2007 01:04 PM
How can I edit Link of title to directly website coreduo Questions and Comments 2 10-16-2006 02:54 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development