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

Post a thread so looks like resource manager message

Discussion in 'XenForo Development Discussions' started by LPH, Apr 4, 2013.

  1. LPH

    LPH Well-Known Member

    I'd like to modify the following code so $body message posted to the new thread looks like what happens when a new resource is added or updated.

    So, it would be a message stating a new blog entry has been created, then a trimmed quote, followed by a message to continue reading.

    This issue I'm having is getting the user name to display in the $body 'submitted ...' section

        $body '';
    $post_contains == 'full')
    $body =   'submitted a new blog post';  // This is NOT correct
    $body .= '[quote]' XenForo_Helper_String::autoLinkBbCode(XenForo_Html_Renderer_BbCode::renderFromHtml(nl2br($content))) . "[/quote]";
    /* Add preg_replace */
    $body preg_replace('#\[nlposts .*\]#'''$body);
    /* Add Trim to 500 Words */
    $body XenForo_Helper_String::wholeWordTrim($body500);

    $body .= "[URL='" get_permalink($post->ID) . "']Continue reading the Original Blog Post[/URL]";

    $postWriter $writer->getFirstMessageDw();

    Thank you for your help.
  2. LPH

    LPH Well-Known Member

    I've tried {name} , username, $user['username'] ... any suggestion would be appreciated. It's probably obviously.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    Have you checked DataWriter/Resource.php from line 501?
  4. LPH

    LPH Well-Known Member

    I've been up and down that file but am going to re-open it now that you've suggested it !
  5. xf_phantom

    xf_phantom Well-Known Member

    post your complete code

    is this the xenscript bridge?
    if yes you can use
  6. LPH

    LPH Well-Known Member

    OK. I looked at that earlier and didn't understand. That line calls a phrase and in the phrase is {username}. But I tried {username} and the site will not load. So maybe I'm not understanding how to write the $body line.

    Should I build a phrase and try to rewrite the code that way? Can't I just pull the username another way?

    {username} submitted a new resource:
    [url={resourceLink}]{title}[/url] (version {version}) - {tagLine}
    [url={resourceLink}]Read more about this resource...[/url]
  7. LPH

    LPH Well-Known Member

    This is the line I'm trying to get to post the username:

    SOMETHING NEEDS TO GO HERE  'submitted a new blog post';  // This is NOT correct
    Oh, and yes, this is the bridge.
  8. Nasr

    Nasr Well-Known Member

    Shouldn't it go in a template?
  9. xf_phantom

    xf_phantom Well-Known Member

    $body $XF->visitor->get('username') . ' submitted a new blog post';
  10. LPH

    LPH Well-Known Member

    I thought I did that a few hours ago ;)

    Let me try again.
  11. LPH

    LPH Well-Known Member

    Well strip my gears and call me shiftless ... I know I tried that sucker hours ago... LOL. Anyway, the extra ) had to be removed but it's working.

    $body $XF->visitor->get('username') . ' submitted a new blog post';
    Now this looks much nicer !

    Thank you all for the help.
    xf_phantom likes this.

Share This Page