WordPress “logged in as” Avatar

Posted November 9th, 2009 in Archive by Darfuria - 0 Comments

I’ve recently made a couple of membership websites in WordPress, which has been an experience, to say the least.

A popular feature of a typical website that allows you to login, is to have a “you are logged in as:” box, that displays your avatar, username, and often a link to edit your profile. Naturally I’ve been trying to replicate this functionality on one of the websites I am building. It came as a surprise that there is very little native avatar support in WordPress, which I think is a bit silly considering it is essentially a blogging platform that has escaped and run wild. Never the less, as is usually the case with WordPress, a bit of careful prodding reveals that there are ways around such things.

Now, I’ve not bothered to look into using a third party avatar plugin for this – I’m just going to stick with using the default Gravatar or get over it option.

So, to begin with, to get a user’s avatar outside of The_Loop, we need to refer to a global variable. Global variables are used for a number of reasons – backwards compatibility being one of the main ones, and these variables shouldn’t be over-used. They are, however, essential for this. The global variable we use will allow us to get information from the set_current_user function. Obviously if a user isn’t logged in, then the avatar will have to fall back on a default image, or you could write your code in such a way that the avatar is only displayed if a user is logged in.

So, with no wrapping code, this is how you display a user’s avatar, if a user is logged in:


< ?php global $user_email ?>
< ?php echo get_avatar($user_email, '50'); ?>

I was going to post a whole thing about writing a “logged in as” box, but I was having a problem with code being parsed, despite me asking the WYSIWYG not to parse code… Oh well.

WordPress Post Image With Default

Posted August 11th, 2009 in Archive by Darfuria - 0 Comments


< ?php if (post_custom('page_image')) { ?>

< ?php } else { ?>

< ?php } ?>

WordPress Get Root Page ID

Posted July 21st, 2009 in Archive by Darfuria - 2 Comments
function get_root_parent($page_id) {
global $wpdb;
$parent = $wpdb->get_var("
SELECT post_parent
FROM $wpdb->posts
WHERE post_type='page'
AND ID = '$page_id'");
if ($parent == 0) return $page_id;
else return get_root_parent($parent);
}

132 WordPress Pingback Addresses

Posted July 15th, 2009 in Archive by Darfuria - 8 Comments

The more pingback addresses you have, the more chance you have of drawing traffic to your website – because more websites are being notified that you have updated your blog. So, here’s a nice big list of pingback addresses that you can add to your WordPress installation’s settings.

http://rpc.pingomatic.com/

http://api.moreover.com/RPC2

http://api.my.yahoo.co.jp/RPC2

http://api.my.yahoo.com/RPC2

http://audiorpc.weblogs.com/RPC2

http://blog.goo.ne.jp/XMLRPC

http://blogpeople.net/ping

http://blogsearch.google.ae/ping/RPC2

http://blogsearch.google.at/ping/RPC2

http://blogsearch.google.be/ping/RPC2

http://blogsearch.google.bg/ping/RPC2

http://blogsearch.google.ca/ping/RPC2

http://blogsearch.google.ch/ping/RPC2

http://blogsearch.google.cl/ping/RPC2

http://blogsearch.google.co.cr/ping/RPC2

http://blogsearch.google.co.hu/ping/RPC2

http://blogsearch.google.co.id/ping/RPC2

http://blogsearch.google.co.il/ping/RPC2

http://blogsearch.google.co.in/ping/RPC2

http://blogsearch.google.co.it/ping/RPC2

http://blogsearch.google.co.jp/ping/RPC2

http://blogsearch.google.co.ma/ping/RPC2

http://blogsearch.google.co.nz/ping/RPC2

http://blogsearch.google.co.th/ping/RPC2

http://blogsearch.google.co.uk/ping/RPC2

http://blogsearch.google.co.ve/ping/RPC2

http://blogsearch.google.co.za/ping/RPC2

http://blogsearch.google.com.ar/ping/RPC2

http://blogsearch.google.com.au/ping/RPC2

http://blogsearch.google.com.br/ping/RPC2

http://blogsearch.google.com.co/ping/RPC2

http://blogsearch.google.com.do/ping/RPC2

http://blogsearch.google.com.mx/ping/RPC2

http://blogsearch.google.com.my/ping/RPC2

http://blogsearch.google.com.pe/ping/RPC2

http://blogsearch.google.com.sa/ping/RPC2

http://blogsearch.google.com.sg/ping/RPC2

http://blogsearch.google.com.tr/ping/RPC2

http://blogsearch.google.com.tw/ping/RPC2

http://blogsearch.google.com.ua/ping/RPC2

http://blogsearch.google.com.uy/ping/RPC2

http://blogsearch.google.com.vn/ping/RPC2

http://blogsearch.google.com/ping/RPC2

http://blogsearch.google.de/ping/RPC2

http://blogsearch.google.es/ping/RPC2

http://blogsearch.google.fi/ping/RPC2

http://blogsearch.google.fr/ping/RPC2

http://blogsearch.google.gr/ping/RPC2

http://blogsearch.google.hr/ping/RPC2

http://blogsearch.google.ie/ping/RPC2

http://blogsearch.google.in/ping/RPC2

http://blogsearch.google.it/ping/RPC2

http://blogsearch.google.jp/ping/RPC2

http://blogsearch.google.lt/ping/RPC2

http://blogsearch.google.nl/ping/RPC2

http://blogsearch.google.pl/ping/RPC2

http://blogsearch.google.pt/ping/RPC2

http://blogsearch.google.ro/ping/RPC2

http://blogsearch.google.ru/ping/RPC2

http://blogsearch.google.se/ping/RPC2

http://blogsearch.google.sk/ping/RPC2

http://blogsearch.google.tw/ping/RPC2

http://blogsearch.google.us/ping/RPC2

http://feedsky.com/api/RPC2

http://hamo-search.com/ping.php

http://holycowdude.com/rpc/ping/

http://ping.blogoon.net/

http://ping.blogs.yandex.ru/RPC2

http://ping.fc2.com/

http://ping.feedburner.com/

http://ping.kutsulog.net/

http://ping.myblog.jp/

http://ping.namaan.net/rpc

http://ping.snap.com/ping/RPC2

http://ping.syndic8.com/xmlrpc.php

http://ping.weblogalot.com/rpc.php

http://ping.wordblog.de/

http://r.hatena.ne.jp/rpc

http://rpc.bloggerei.de/ping/

http://rpc.blogrolling.com/pinger/

http://rpc.icerocket.com:10080/

http://rpc.pingomatic.com

http://rpc.reader.livedoor.com/ping

http://rpc.technorati.com/rpc/ping

http://rpc.technorati.jp/rpc/ping

http://rpc.twingly.com/

http://rpc.weblogs.com/RPC2

http://wasalive.com/ping/

http://www.blogpeople.net/servlet/weblogUpdates

http://xmlrpc.blogg.de

http://xping.pubsub.com/ping/

http://zhuaxia.com/rpc/server.php

http://pingoat.com/goat/RPC2

http://api.feedster.com/ping

http://api.moreover.com/ping

http://api.my.yahoo.com/rss/ping

http://www.blogdigger.com/RPC2

http://www.blogshares.com/rpc.php

http://www.blogsnow.com/ping

http://www.blogstreet.com/xrbin/xmlrpc.cgi

http://bulkfeeds.net/rpc

http://www.newsisfree.com/xmlrpctest.php

http://ping.blo.gs/

http://www.azfeeds.com/

http://www.blogsearchengine.com/

http://www.blogtopsites.com/

http://www.feedbase.net/

http://www.feedsubmitter.com/

http://www.fybersearch.com/

http://www.plazoo.com/

http://www.readablog.com/

http://www.rssfeeds.com/

http://www.rssmad.com/

http://www.rss-spider.com/

http://blo.gs/ping.php

http://www.pingerati.net/

http://feedshark.brainbliss.com/

http://www.pingmyblog.com/

http://geourl.org/ping

http://ipings.com/

http://www.icerocket.com/

http://www.weblogalot.com/ping

http://rpc.wpkeys.com

http://rpc.britblog.com

http://cullect.com/feed/ping

http://ping.bitacoras.com

http://topicexchange.com/RPC2

http://www.blogoole.com/ping/

http://www.popdex.com/addsite.php

http://www.wasalive.com/ping/

http://www.weblogues.com/RPC/

http://blogping.unidatum.com/RPC2/