Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: [1] 2

Author Topic: [MOD] Article Auto-Pinger  (Read 8277 times)

quaffapint

  • Newbie
  • *
  • Karma: 0
  • Posts: 14
[MOD] Article Auto-Pinger
« on: April 19, 2007, 11:22:55 pm »

After you add this mod - when you edit or create a new article, snews will ping ping-o-matic with your site name and url, letting them know that you have updated content.  Ping-o-matic pings multiple services, such as technorati, and such, allowing your RSS feed to flow freely on the ether...

First you need to download some supporting files.  I'm currently hosting the zip on one site, but might need to move it at some point...So, download the zip and extract it (with directories intact) to the root of your snews directory, so you have a directory called 'xmlrpc' with all the files/directories in it.

http://www.womanlyadvice.com/xmlrpc.zip

You will also want to CHMOD the 'ping.log' file to 777 in the 'xmlrpc' directory to allow for logging (if you want).

Second, you'll need to edit snews.php to add the ping function and to call the ping function after an article edit or add.

Somewhere in snews.php add this function...
Quote
// Pinger
function ping() {
  require_once('xmlrpc/weblog_pinger.php');
  $pinger = new Weblog_Pinger();
  $pinger->ping_ping_o_matic(s('website_title'), db('website'));
}
then find this line...
Quote
switch ($pos) {case 1: $link = 'articles/'; break; case 2: $link = 'extra_contents/'; break; case 3: $link = 'pages/'; break;}
...and under it add...
Quote
ping();
if you also want to ping after an article edit, then find this line...
Quote
$link = (substr($position, 0, 1) != '2') ? find_cat_sef($category).'/'.retrieve('seftitle', 'articles', 'id', $id).'/' : (find_cat_sef($category) != s('home_sef') ? find_cat_sef($category).'/' : '');
...and under it add...
Quote
ping();
...done...

By default, I have it echoing out the results to the screen (I was having hosting troubles with permissions on the log file) after you save the article.

Hope it's helpful to someone and let me know how it goes.
Matt
Logged

David

  • Hero Member
  • *****
  • Karma: 7
  • Posts: 567
[MOD] Article Auto-Pinger
« Reply #1 on: April 19, 2007, 11:47:35 pm »

thanks! :)
Logged

piXelatedEmpire

  • MIA
  • ULTIMATE member
  • ******
  • Karma: 37
  • Posts: 1401
  • currently MIA
[MOD] Article Auto-Pinger
« Reply #2 on: April 20, 2007, 02:07:30 am »

oh this is GREAT! Some really cool MODs popping up lately :)
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

gunnar_soroos

  • Newbie
  • *
  • Karma: 0
  • Posts: 17
    • http://www.rochesterflyers.com
[MOD] Article Auto-Pinger
« Reply #3 on: April 20, 2007, 05:00:26 am »

YES! I've been waiting for this one. Will install it extreemly soon.
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Article Auto-Pinger
« Reply #4 on: April 20, 2007, 09:13:16 am »

Whuhaaa. Quaffapint, good work, mate.
Logged
"It's only dead fish that goes with the flow... "
Updated

quaffapint

  • Newbie
  • *
  • Karma: 0
  • Posts: 14
[MOD] Article Auto-Pinger
« Reply #5 on: April 20, 2007, 02:37:23 pm »

Thanks, folks...Always happy to help out where I can  :) .  If anyone has any troubles or what have you, please just let me know.

Matt
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
[MOD] Article Auto-Pinger
« Reply #6 on: April 20, 2007, 04:07:40 pm »

That is superb quaffapint !!!
Thanks a lot.  :)

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
[MOD] Article Auto-Pinger
« Reply #7 on: April 21, 2007, 02:18:50 am »

really good. really, really good. Did I mention I think it's really good? I think it is. Thanks!
(Really good.) :D
Logged

tobto

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 71
    • seo service
[MOD] Article Auto-Pinger
« Reply #8 on: April 21, 2007, 03:36:13 pm »

nice job! thanks!
Logged

gunnar_soroos

  • Newbie
  • *
  • Karma: 0
  • Posts: 17
    • http://www.rochesterflyers.com
[MOD] Article Auto-Pinger
« Reply #9 on: April 23, 2007, 06:41:47 pm »

I CHMOD'ed the ping.log file to 777 but still get this:
File ping.log is not writable

Pings are successful, but no log. Did I miss something?
Logged

quaffapint

  • Newbie
  • *
  • Karma: 0
  • Posts: 14
[MOD] Article Auto-Pinger
« Reply #10 on: April 23, 2007, 08:00:01 pm »

Quote from: gunnar_soroos
I CHMOD'ed the ping.log file to 777 but still get this:
File ping.log is not writable

Pings are successful, but no log. Did I miss something?
No - You didn't miss anything - I have the same problem on my host.  That's why I echo'd it out to the screen, since I couldn't get the log writable and didn't troubleshoot it any further  :) .
Logged

DrPeter

  • Newbie
  • *
  • Karma: 0
  • Posts: 8
[MOD] Article Auto-Pinger
« Reply #11 on: July 19, 2007, 04:27:25 pm »

Is this adaptable to 1.6?

Is there another way to provide/add this service to sNews?

Tks
Peter
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[MOD] Article Auto-Pinger
« Reply #12 on: July 19, 2007, 06:37:49 pm »

Quote from: DrPeter
Is this adaptable to 1.6?
Is there another way to provide/add this service to sNews?
Tks
Peter
I haven't tried it myself... but knowing that a lot of the functions in 1.6 snews.php are the same as they were in 1.5.31... and that the code in the mod-post ( #1) doesn't affect much... I would say you should be able to drop this into sNews 1.6's snews.php file and it should work. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

DrPeter

  • Newbie
  • *
  • Karma: 0
  • Posts: 8
[MOD] Article Auto-Pinger
« Reply #13 on: July 20, 2007, 04:36:49 am »

Thanks keyrocks. I might as well just give it a go then.

In 1.6 the ping(); insert would be entered following line 1596 in the unmodified code. I'm not strong on php so may I ask: Am I right in thinking this will activate the ping function only when an article is actually published and not merely when it is saved? For instance, if the time for publication is set to the future, will ping be called only after the publication time?

Thanks
Peter
Logged

brianvtm

  • Newbie
  • *
  • Karma: 0
  • Posts: 10
[MOD] Article Auto-Pinger
« Reply #14 on: July 20, 2007, 03:52:42 pm »

Great addition!
Logged
Pages: [1] 2