Advertisement:

Author Topic: User RSS URL Function  (Read 847 times)

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
User RSS URL Function
« on: September 19, 2015, 08:28:23 pm »
Hi all,

I wanted to enable RSS for my users so they are offered an easy way to share their personal ads with their personal website(s) or any other for that matter/ My philosophy is; sharing beats trying to create a monopoly so i created a function for this that yes yes also takes REWRITES into account(!) (Permalinks) 8)

This could actually be very well be an official Osclass helper function I think but for now copy & paste the following code in your theme's functions.php:
Code: [Select]
// Function that return the user's Public Profile Items RSS
// Optional parameter to sent userId along with request
function osc_rss_items_user_url($user='') {
if($user=='') { $user=osc_user_id(); }
if(osc_rewrite_enabled()) {
$path = osc_base_url() . osc_get_preference('rewrite_search_url') . '/' . osc_get_preference('rewrite_search_user') . ',' . $user . '/sFeed,rss';
} else {
$path = sprintf(osc_base_url(true) . '?page=search&sUser=%d&sFeed=rss', $user);
}
return $path;
}

Hope this inspires others as well trying to utilize Osclass to the max ;D


Have fun,
Eric