WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Feed Key] adding key to ALL feeds

[Plugin: Feed Key] adding key to ALL feeds

  • hi hami,
    you are doing great work with your plugins. i mentioned lately when using members-only and feed-key, that the feed-key is not implemented in all rss-feeds that are offered … actually it would be useful, when the feed-key is automaticalli added to ALL or maybe to selectable categories or elements (eg. the status-bar … )

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Feed Key] adding key to ALL feeds’ is closed to new replies.
Skip to toolbar