submit hooks

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-25-2007, 09:11 AM
Casual Pligger/Coder
 
Join Date: Jun 2007
Posts: 32
Hello,
I added three hooks into submit.php. I needed those hooks to implement two modules.
The first module allows the admin to give users permissions to post editorials even when editorials are disabled. I needed hooks in do_submit0, do_submit1 and do_submit2 to make this work.

The second plugin generates XML sitemaps and ping google, yahoo and ask every time when a new story is posted to that they re download the sitemap. For the ping to work I added a hook in do_submit3
I will release both plugins in the following days, after I do some more testing. I would like to see some developer's opinion about this.

Any chance those hooks could be added in the next release of pligg? I like to keep my code in sync with the main code. I try to do any modifications as modules but sometimes this would just not work without minor modifications like adding some hooks. It would be great if I would not have to add those hooks again after an upgrade. I am sure other will benefit from using the plugins and would like that too.

Here is a diff file between my code and submit.php from pligg 9.6

Code:
--- submit.php  2007-03-28 19:39:38.000000000 +0300
+++ ../pligg/submit.php 2007-06-23 23:20:10.000000000 +0300
@@ -81,6 +81,7 @@
   $main_smarty->assign('pagename', pagename);
 
        $main_smarty->assign('tpl_center', $the_template . '/submit_step_1');
+       check_actions('do_submit0');
        $main_smarty->display($the_template . '/pligg.tpl');
 }
 
@@ -122,6 +123,7 @@
                $linkres->url_title = "";
        }
 
+       check_actions('submit_validating_url',array("url" => $url,'linkres'=>&$linkres));
        if(!$linkres->valid) {
                $main_smarty->assign('submit_error', 'invalidurl');
                $main_smarty->assign('tpl_center', $the_template . '/submit_errors');
@@ -144,7 +146,6 @@
                }
        }
 
-       check_actions('submit_validating_url', array("url" => $url));
 
        totals_adjust_count('discard', 1);
 
@@ -195,7 +196,7 @@
 
        define('pagename', 'submit'); 
   $main_smarty->assign('pagename', pagename);
-
+       check_actions('do_submit1');
        $main_smarty->display($the_template . '/pligg.tpl');
 }
 
@@ -212,7 +213,7 @@
 
        define('pagename', 'submit'); 
   $main_smarty->assign('pagename', pagename);
-
+       check_actions('do_submit2');
        $main_smarty->display($the_template . '/pligg.tpl');
 
 }
@@ -233,7 +234,7 @@
        $linkres->store_basic();
 
        $linkres->check_should_publish();
-
+       check_actions('do_submit3',array('linkres'=>&$linkres));
        if(!empty($_POST['trackback'])) {
                require_once(mnminclude.'trackback.php');
                $trackres = new Trackback;
@@ -284,4 +285,4 @@
        }
        return $error;
 }
-?>
\ No newline at end of file
+?>
If you wander why I moved check_actions('submit_validating_url' right before the link validation test, that is because I wanted my action to set $linkres->valid=true if the user has permission to post an editorial even if editorial posting is disabled.

In do_submit3 I pass $linkres to the action function my reference because I want to use that in another module that would set up a nice title when sending a trackback ( currently it sets the same trackback link anchor for everything, my module will set the title ( the link anchor ) to be the actual story title so it will be different for each story.
Reply With Quote
  #2 (permalink)  
Old 06-25-2007, 05:21 PM
New Pligger
 
Join Date: Jun 2007
Posts: 3
Quote:
Originally Posted by mihai View Post

The second plugin generates XML sitemaps and ping google, yahoo and ask every time when a new story is posted to that they re download the sitemap. For the ping to work I added a hook in do_submit3
please add me on your notify list. i'm VERY anxious (and desperate) to add this feature. it's almost 4:30am where i am right now and i've been searching for the past 6 hours!!

thanks
Reply With Quote
  #3 (permalink)  
Old 06-28-2007, 02:49 AM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
Hi, I have a development server set up and would like to try your sitemap module. I think that's a really cool idea. Does one need an account or api code to submit sitemaps to those sites?

Best,
Cent
Reply With Quote
  #4 (permalink)  
Old 06-28-2007, 11:47 AM
Casual Pligger/Coder
 
Join Date: Jun 2007
Posts: 32
I have this module running on a pligg site I launched two weeks ago. The site is a Romanian news site named Sapa.ro .
Here is how the sitemap looks like: http://sapa.ro/sitemapindex.xml .
That's actually split sitemap ( sitemap index ).
The sitemap is actually generated dynamically even if it looks like a static xml file. I made it look static because ask.com would not accept anything not ending in .xml.
Reply With Quote
  #5 (permalink)  
Old 06-28-2007, 11:54 AM
Casual Pligger/Coder
 
Join Date: Jun 2007
Posts: 32
you need an API key only if you want to ping Yahoo.
I'm thinking about moving the pinging part to a separate module, because there would be the possibility of adding new services like pingomatic and this would have nothing to do with sitemaps.
what do you think about this ?
Reply With Quote
  #6 (permalink)  
Old 06-28-2007, 11:01 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
sounds interesting... if you need me to test any modules, let me know.

Best,
Cent
Reply With Quote
  #7 (permalink)  
Old 07-03-2007, 12:20 AM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
The hooks have been added to the 9.x code and will be in the Beta 9.7 release.
Reply With Quote
  #8 (permalink)  
Old 07-03-2007, 03:45 AM
Casual Pligger/Coder
 
Join Date: Jun 2007
Posts: 32
Where exactly in svn is the code that will become beta 9.7 ? Is it in trunk or in branches ?
Reply With Quote
  #9 (permalink)  
Old 07-17-2007, 03:10 PM
SoapTaco's Avatar
Casual Pligger
Pligg Version: 9.9.0
Pligg Template: All
 
Join Date: Nov 2006
Location: Detroit, MI
Posts: 78
Send a message via Skype™ to SoapTaco
Looking for the ping plugin, I would like to add it as soon as possible, any news?
Reply With Quote
  #10 (permalink)  
Old 07-18-2007, 09:12 AM
Casual Pligger/Coder
 
Join Date: Jun 2007
Posts: 32
I didn't get the chance to split the sitemap part from the pinging part yet. Maybe I should just release what I have so far
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit Antispam Addon v 0.1 AnAlienHolakres3 Free Modules 45 12-05-2011 12:48 AM
Auto submit story on submit step 3 for god only gnalkit Questions and Comments 3 03-30-2011 01:09 AM
How to Remove submit step1 of 3 from submit page slick33 Questions and Comments 8 01-10-2011 05:18 PM
Skip submit step 3 for god gnalkit Questions and Comments 3 05-12-2009 05:22 AM
Disable user submit Swede Questions and Comments 2 04-16-2009 12:02 PM


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