XF 1.4 Why can't we sync feeder posting user with {author}?

mauzao9

Well-known member
This is something that confuses me.

Having one external blog where the members who post are all registered on the forum under the same name, it was for hope the Feeder system was capable to recognize {author} as the posting user and just display that as our forum user instead. Sad for me when that didn't happen.

But still, there are sites with external blogs who the poster of the feeder thread is the same username from the poster of the blog article.

My question is, how?
 
This is something that confuses me.

Having one external blog where the members who post are all registered on the forum under the same name, it was for hope the Feeder system was capable to recognize {author} as the posting user and just display that as our forum user instead. Sad for me when that didn't happen.

But still, there are sites with external blogs who the poster of the feeder thread is the same username from the poster of the blog article.

My question is, how?
when setting up the feed....
sdaf.webp
Those sites probably have a feed per user they want feeds from (possibly directing all sources of feeds to create threads in the same forum) and are probably doing it using the option in the image above.
 
I think I misunderstood you before but if from that image above when configuring your feeds you use the first option (Post as guest, use name information from feed data.) it should do exactly what (I think) you want.

fgfdgs.webp
 
I tried to do it, it will still post as guest no matter the user accounts with their names =/
That's wordpress, isn't there a way to sort such feed by each creator?
 
I tried to do it, it will still post as guest no matter the user accounts with their names =/
That's wordpress, isn't there a way to sort such feed by each creator?
I really don't know what to tell you, I just tested the example feed you posted and showed a screenshot of it grabbing the author name.
 
Yes, my objective is do like they do, not only grab the name, use the article creator name as the poster account name, so it's not used as guest. hm
 
Well, it works with the example you posted which I just showed you. If you don't post a link to the site and feed you are trying to use I can not tell you anything really.
 
He wants the messages to actually be associated with the user, not just the name.

That would require some amount of custom development.
 
I usually hate direct code edits, but this works.

Locate the file library/XenForo/Model/Feed.php.

Locate these two lines:
PHP:
// post as guest, using the author name(s) from the entry
$writer->set('username', XenForo_Helper_String::wholeWordTrim($entryData['author'], 25, 0, ''));

Replace with:
PHP:
/** @var $userModel XenForo_Model_User */
$userModel = $this->getModelFromCache('XenForo_Model_User');

$user = $userModel->getUserByName($entryData['author']);
if ($user)
{
    $writer->set('user_id', $user['user_id']);
    $writer->set('username', $user['username']);
}
else
{
    // post as guest, using the author name(s) from the entry
    $writer->set('username', XenForo_Helper_String::wholeWordTrim($entryData['author'], 25, 0, ''));
}

This will only work if the feed option "Post as guest, use name information from feed data" is selected.

I just imported to my dev board the RSS feed from the Xen Resources News and Announcements forum:

upload_2014-9-16_10-23-58.webp

As you can see, the thread by me at XR has been authored by my actual user account, whereas the thread by Brogan at XR has been authored as a guest (because he doesn't exist as a user on my dev board).

Be weary of relying heavily on direct code edits on a live forum as there is some effort involved in reapplying them after each XF update. An add-on to achieve this would be better.
 
@Chris D thank you! This is really perfect on it, because we have one external site where things are posted, it's safe to have this as the accounts on the blog will be the same on live site.
I don't know how to create one addon but actually would be a nice idea just one new option on the feeder to "Match Author name with forum user", i find it may be useful for other forum owners around that would want to achieve something like this! :)
 
Just a quick question: there are a lot of common names in use, so what happens if the author did have the same name as a user on your board? Your user would be given credit for something they did not author. Personally, I would just leave it as @EQnoble suggests. Unless, of course you know for sure that the feeder is bringing in articles authored only by your forum members, then use Chris's modification above.
 
Unless, of course you know for sure that the feeder is bringing in articles authored only by your forum members, then use Chris's modification above.
This was my understanding of the use case, too. I agree with Lawrence. I'd only recommend doing this if the author will always be one of your own users, e.g. cross posting from an external blog you operate to your forum.
 
Yes @Lawrence i only have this feed for now and the accounts are set correctly. That's why such would need to be one addon with one extra option so who sets the feed is aware, this is mostly for people who have one Blog or CMS that they would like to see the news posted also on forum with their own usernames, like i mentioned on that example earlier (only that they had to brigde Xenforo to WordPress just for that, this is way easier).
 
Top Bottom