Programmatically setting the author of a feed
-
The users on my site have a custom field ‘rss’. I want my users to be able to subscribe to feeds, using this field. I also want the user that subscribed to a particular feed, to be the author of the posts generated by that feed. Programatically subscribing to feeds works, but I dont know how to automatically set the author. This is what i got so far:
add_action( 'profile_update', 'register_rss_feed', 10, 2 ); function register_rss_feed( $user_id, $old_user_data ) { $rssUrl = get_field('rss', 'user_' . $user_id); if($rssUrl){ $user = get_user_by("id", $user_id); $link_id = FeedWordPress::syndicate_link($user->display_name, $rssUrl, $rssUrl); var_dump($link_id); if (is_numeric($link_id) and $link_id > 0) : //Do something to set the author for the feed, using $user_id endif; } }
Thanks in advance
- The topic ‘Programmatically setting the author of a feed’ is closed to new replies.