1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Questions and Support' started by mauzao9, Sep 16, 2014.

  1. mauzao9

    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?
  2. EQnoble

    EQnoble Well-Known Member

    when setting up the feed....
    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.
  3. mauzao9

    mauzao9 Well-Known Member

  4. EQnoble

    EQnoble Well-Known Member

    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.

  5. mauzao9

    mauzao9 Well-Known Member

    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?
  6. EQnoble

    EQnoble Well-Known Member

    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.
  7. mauzao9

    mauzao9 Well-Known Member

    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
  8. EQnoble

    EQnoble Well-Known Member

    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.
  9. Mike

    Mike XenForo Developer Staff Member

    He wants the messages to actually be associated with the user, not just the name.

    That would require some amount of custom development.
  10. EQnoble

    EQnoble Well-Known Member

    Ahh ok that wasn't so clear to me, makes sense now going back and looking at it though.
  11. Chris D

    Chris D XenForo Developer Staff Member

    I usually hate direct code edits, but this works.

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

    Locate these two lines:
    // post as guest, using the author name(s) from the entry
    $writer->set('username'XenForo_Helper_String::wholeWordTrim($entryData['author'], 250''));
    Replace with:
    /** @var $userModel XenForo_Model_User */
    $userModel $this->getModelFromCache('XenForo_Model_User');

    $user $userModel->getUserByName($entryData['author']);
    if (
    // post as guest, using the author name(s) from the entry
    $writer->set('username'XenForo_Helper_String::wholeWordTrim($entryData['author'], 250''));
    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:


    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.
    Veer and mauzao9 like this.
  12. mauzao9

    mauzao9 Well-Known Member

    @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! :)
    Chris D likes this.
  13. Chris D

    Chris D XenForo Developer Staff Member

    Not sure if a suggestion for it already exists, but if not, it would be a good idea to make a suggestion.
  14. Lawrence

    Lawrence Well-Known Member

    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.
    Chris D likes this.
  15. Chris D

    Chris D XenForo Developer Staff Member

    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.
    Lawrence likes this.
  16. mauzao9

    mauzao9 Well-Known Member

    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).

Share This Page