how to show a profile field, for example twitter in any page/template,not only in user/profile page?
  • i want to put twitter value at user in a article-aside for example, but i cant find the way to do it

    somebody know it?

    thanks!
    Post edited by Raul Andres at 2013-03-14 11:42:13
  • 7 Comments sorted by
  • Is possible with newscoop own methods OR

    Is neccesary make call a php function with sql queries from a smarty .tpl file? and with this way get twitter, bio, and another attributes from users/editors?

    i review differents newscoop templates doc and try different methods but it doesnt work for me...

    thx

  • Vote Up0Vote Down MarinaMarina
    Posts: 296Member
    Hi Raul! Yes, you need to call with Smarty-query to user DB.
    The example here - layout.tpl.

    <p>         
                    
        {{ foreach $profile as $label => $value }}
        {{ if !empty($value) }} 
       
        {{ if $label == "bio" }}
          <em>About:</em> 
          {{ $value|default:"n/a" }}<br />
        {{ elseif $label == "birth_date" }}
          <em>Date of birth:</em>
          {{ $value|default:"n/a" }}<br />
        {{ elseif $label == "comment_delivered" }}
          <em>Comments sent:</em>
          {{ $value|default:"n/a" }}<br />  
        {{ elseif $label == "comment_recommended" }}
          <em>Recommended comments:</em>
          {{ $value|default:"n/a" }}<br />   
        {{ elseif $label == "gender" }}
          <em>Gender:</em>
          {{ $value|default:"n/a" }}<br />     
        {{ elseif $label == "organisation" }}
          <em>Organisation:</em>
          {{ $value|default:"n/a" }}<br />             
        {{ elseif $label == "website" }}
          <em>Website: </em>
         
    <a rel="nofollow" href="http://{{ $profile['website']|escape:url
    }}">{{ $profile['website']|escape }}</a><br />     
        {{ /if }}
         
        {{ /if }}   
        {{ /foreach }}

        </p>


  • Marina, yes, i view similar code in user_profile.tpl, but it only work for me inside user_profile.tpl and show it in profile user page.

    If i try put the same code in a new tpl it doesnt work.

    How to get works any template, i think so i have a issue relation with a controller or view

    thx u for your help

    Post edited by Raul Andres at 2013-04-08 04:23:42
  • Hi, Raul.
    All information about user are stored in liveuser_users and user_attribute tables. user_attribute  has one field about twitter, it's twitter account name. So, you can load data by dynamicly via twitter api, or modify register script and import user data from twitter account.

    So, if you want import data from twitter account to newscoop account, you must modfy registration procedure, scripts, which add info into db when user registers via website intefcae or modify our info. When admin adds user from adminpanel or modify his info.
  • Thanks Ruslan, not, only i want show twitter of each user in different pages of profile page. My interest is show twitter in a different of page/template different at http://xxx/user/profile/<user&gt; that it use user_profile.tpl template, and from here is possible get twitter of user, but not from another new tpl created.

    I know tables that you say me: liveuser_users and user_attribute, but i want to avoid to create custom smarty-query to get twitter of a newscoop user. And i want to know the way to access attributtes data of each user with $gimme or another newscoop structure than i unknown on the moment.

    thx.


  • Vote Up0Vote Down Paweł MikołajczukPaweł Mikołajczuk
    Posts: 72Member, Sourcefabric Team
    @Raul - i think that you need list_user function: https://wiki.sourcefabric.org/display/NsLingo/Listing+users
  • Thx Pawel, i tried list_users function but doesnt work too, because later, inside {{ list_users }} isnt possible to put: 

    {{ $gimme->list_user->twitter }} to get twitter account

    The same problem  to get image of a user image in Comments! :

    {{ $gimme->list_user->picture }} to get image profile 

    or {{ $gimme->list_user->imageurl }} doesnt work too

    or inside list_article_comments block isnt posible to do:  {{ $gimme->comment->user->image/picture }}

     :( :( :( ... yes three... 


    @Raul - i think that you need list_user function: https://wiki.sourcefabric.org/display/NsLingo/Listing+users