This is my code to retrieve feedkey from wordpress db for logged user:
<a href="
<?php
global $current_user;
$feedvalue = $wpdb->get_var("SELECT meta_value FROM $wpdb->usermeta WHERE user_id='$current_user->ID' AND meta_key='feed_key'");
echo (get_bloginfo('url').("?feed=rss2&feedkey=").($feedvalue));?>">Post RSS Feed</a>
If it can be helpful
Hi,
Had an idea on another method for adding the feedkey to any feed links for a currently logged in user. This code could be added to the feed-key.php plugin:
function feedkey_feed_link($feed_link)
{
global $current_user;
$feedkey = get_usermeta($current_user->ID,'feed_key');
$permalink_structure = get_option(permalink_structure);
//Check if Permalinks are being used
//If feed key is defined for this user
if (is_user_logged_in() && !empty($feedkey))
{
empty($permalink_structure) ? $feedjoin = '&feedkey=' : $feedjoin = '?feedkey=';
$output = $feed_link.$feedjoin.$feedkey;
}
else
$output = $feed_link;
return $output;
}
add_action('feed_link', 'feedkey_feed_link', 10, 1);
Hooking this action means that the rss link is updated whenever it is added to a page. It works with/without permalinks, and for the basic feed query strings – eg. ‘rss2_url’ or ‘comments_rss2_url’, but I haven’t tested it against more complex rss query strings.
hi woody3k
intresting hack – but i didn´t figure out, in wich files i have to add your code … can you give us a hint??
regards
thinky