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
+?> 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.





Linear Mode




