| |
|
| :: |
| Author |
Message |
ebnx
Joined: 01 Nov 2007 Posts: 21
|
Posted: Wed Nov 14, 2007 8:26 pm Post subject: Show author name in RSS? |
|
|
SeO:
I know that we've been working together to figure out this functionality, but I wanted to share my request with the community in case others were interested as well:
Is there a way to show post author name for posts that appear in RSS feeds? Right now, the author's name does not appear for GYM Sitemaps RSS.
I'd like to have my RSS feed look something like this:
Thanks! |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Sun Nov 18, 2007 8:03 pm Post subject: Re: Show author name in RSS? |
|
|
It's too bad the post_username filed seems to nether be used in the phpbb_post table. It makes the hack heavier to build.
Anyway, here is a decently simple way to do it.
Open mx_ggsitemaps/includes/rss_forum.php and replace :
| Code: | | while ($topic = $db->sql_fetchrow($result)) { |
With :
| Code: | $user_names = $stored_topics = array();
while ($topic = $db->sql_fetchrow($result)) {
$stored_topics[] = $topic;
if (isset($topic['poster_id']) && !isset($user_names[$topic['poster_id']]) ) {
$user_names[$topic['poster_id']] = $topic['poster_id'];
}
if (isset($topic['poster_idF']) && !isset($user_names[$topic['poster_idF']]) ) {
$user_names[$topic['poster_idF']] = $topic['poster_idF'];
}
}
if (!empty($user_names) ) {
$sql_in_user = implode(',', $user_names);
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id IN ( $sql_in_user )";
if ( !($result = $db->sql_query($sql)) ) {
$this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not query forum data', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result)) {
$user_names[$row['user_id']] = $row['username'];
}
$db->sql_freeresult($result);
unset($row);
}
foreach ($stored_topics as $topic) { |
and then add :
| Code: | | $username = !empty($user_names[$topic['poster_idF']]) ? '<i>by ' . $user_names[$topic['poster_idF']] . '</i><br/><br/>' : ''; |
before :
| Code: | | $item_title = htmlspecialchars($topic['topic_title']); |
and replace :
| Code: | | $item_desc = htmlspecialchars( '<div class="item_sub_title">' . $item_opt[$forum_id]['forum_name'] . ' : ' . $topic['topic_title'] . ' </div> ' . $first_message. ' <br/> ' . $topic_stats); |
with :
| Code: | | $item_desc = htmlspecialchars( '<div class="item_sub_title">' . $item_opt[$forum_id]['forum_name'] . ' : ' . $topic['topic_title'] . ' </div> ' . $username . $first_message. ' <br/> ' . $topic_stats); |
add :
| Code: | | $username = !empty($user_names[$topic['poster_id']]) ? '<i>by ' . $user_names[$topic['poster_id']] . '</i><br/><br/>' : ''; |
before :
| Code: | | $item_title = htmlspecialchars(($has_reply && $this->rss_config['rss_first']) ? $topic['topic_title'] . $lang['rss_reply'] : $topic['topic_title']); |
and replace :
| Code: | | $item_desc = htmlspecialchars('<div class="item_sub_title">' . $item_opt[$forum_id]['forum_name'] . ' : ' . $topic['topic_title'] . ' </div>' . $last_message . ' <br/> ' . $topic_stats); |
with :
| Code: | | $item_desc = htmlspecialchars('<div class="item_sub_title">' . $item_opt[$forum_id]['forum_name'] . ' : ' . $topic['topic_title'] . ' </div>' . $username . $last_message . ' <br/> ' . $topic_stats); |
This will add one SQL per cycle on rss feeds, which is a lot better than one per profile and should be a working solution for you to add the poster's user name in your forum feeds
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
ebnx
Joined: 01 Nov 2007 Posts: 21
|
Posted: Sun Nov 18, 2007 11:49 pm Post subject: Re: Show author name in RSS? |
|
|
I just tried the modifications and I'm waiting to see the results...
I have a question about your last two steps--did you repeat those steps by accident? I see the same steps earlier in your message.
Thanks, I'll let you know if it works for me! |
|
|
| Back to top |
|
 |
ebnx
Joined: 01 Nov 2007 Posts: 21
|
Posted: Mon Nov 19, 2007 12:19 am Post subject: Re: Show author name in RSS? |
|
|
Hm...it doesn't seem like the changes worked for me. I'm still not seeing the author name published on my RSS feed.
Any thoughts as to what might be happening? |
|
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Mon Nov 19, 2007 12:33 am Post subject: Re: Show author name in RSS? |
|
|
| Have you cleared the cache? |
|
|
| Back to top |
|
 |
ebnx
Joined: 01 Nov 2007 Posts: 21
|
Posted: Mon Nov 19, 2007 12:41 am Post subject: Re: Show author name in RSS? |
|
|
| Yes, I cleared the cache for everything. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
|
| Back to top |
|
 |
ebnx
Joined: 01 Nov 2007 Posts: 21
|
Posted: Sat Nov 24, 2007 6:34 am Post subject: Re: Show author name in RSS? |
|
|
Thanks for the offer. I'm satisfied with my old solution for now... |
|
|
| Back to top |
|
 |
leviatan21
Joined: 08 Dec 2007 Posts: 5
|
Posted: Tue Dec 11, 2007 3:30 pm Post subject: Post author |
|
|
I made this change, but much more simple.
| Code: | #
#-----[ OPEN ]------------------------------------------------------------------
#
mx_ggsitemaps/includes/rss_forum.php
#
#-----[ FIND ]------------------------------------------------------------------
#
while ($topic = $db->sql_fetchrow($result)) {
#
#-----[ AFTER, ADD ]------------------------------------------------------------
#
// MOD : user link - Start
$user_name = $this->found_user_rss($topic['poster_id']);
$user_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" .$topic['poster_id'] ."");
// MOD : user link - End
#
#-----[ FIND ]------------------------------------------------------------------
#
$this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $item_title, $topic_urlF, $item_time, $item_desc, $item_opt[$forum_id]['forum_rss_url'], htmlspecialchars($item_opt[$forum_id]['forum_name']), $topic_urlF);
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$item_time,
#
#-----[ IN-LINE AFTER ADD ]------------------------------------------
#
$user_name, $user_url,
#
#-----[ FIND ]------------------------------------------------------------------
#
$this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $item_title, $topic_url, $item_time, $item_desc, $item_opt[$forum_id]['forum_rss_url'], htmlspecialchars($item_opt[$forum_id]['forum_name']), $topic_url);
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$item_time,
#
#-----[ IN-LINE AFTER ADD ]------------------------------------------
#
$user_name, $user_url,
#
#-----[ OPEN ]------------------------------------------------------------------
#
mx_ggsitemaps/includes/ggs_functions.php
#
#-----[ FIND ]------------------------------------------------------------------
#
$this->style_config = array('Sitemap_tpl' =>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
. '<pubDate>%s</pubDate>' . "\n\t\t\t" .
#
#-----[ IN-LINE AFTER ADD ]------------------------------------------
#
'<user>%s</user>' . "\n\t\t\t" . '<user_link>%s</user_link>' . "\n\t\t\t" .
#
#-----[ FIND ]------------------------------------------------------------------
#
$this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $chan_title_gen, $this->path_config['root_url'], $chan_time, $chan_desc_gen, $rss_gen_url, htmlspecialchars($this->rss_config['sitename']), $this->path_config['root_url']);
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$this->path_config['root_url']
#
#-----[ IN-LINE AFTER ADD ]------------------------------------------
#
,'',''
#
#-----[ FIND ]------------------------------------------------------------------
#
}
?>
#
#-----[ BEFORE, ADD ]-----------------------------------
#
// MOD : user link - Start
/**
* For link to the user post
* @param int $poster_id
* @return user_name
*/
function found_user_rss($poster_id) {
global $db, $phpEx, $lang;
$sql_username = "SELECT username FROM " . USERS_TABLE . " WHERE user_id = " . $poster_id ;
if ( !($result = $db->sql_query($sql_username)) )
{
message_die(GENERAL_ERROR, 'No se encontró el usuario', '', __LINE__, __FILE__, $sql_username);
}
while( $row = $db->sql_fetchrow($result) )
{
$poster_name = $row['username'];
}
return $poster_name;
}
// MOD : user link - End
#
#-----[ OPEN ]------------------------------------------------------------------
#
ggs_style/mxrss2.xsl
#
#-----[ FIND ]------------------------------------------------------------------
#
Link : <a href="{link}" ><xsl:value-of select="title"/></a><br/>
#
#-----[ BEFORE, ADD ]-----------------------------------
#
Posted by : <a href="{user_link}" title="{user}" > <xsl:value-of select="user" /></a><br/>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM |
I hope it is understood and not having made mistakes  |
|
|
| Back to top |
|
 |
|
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|