How can I echo username

Discussion in 'Subrion Open Source CMS Core' started by whatnot, Mar 13, 2017.

  1. whatnot

    whatnot New Member

    Hi There

    I like to echo username in a block how can this be done

    Thanks
    David
  2. Vasily_B.

    Vasily_B. Project Manager

    Hi David,

    Are you talking about a logged in member?
    What block type do you use?

    Here is the code that gets an authorized user details:
    iaUsers::getIdentity()->username

    You can print the details of this object using this way:
    _v(iaUsers::getIdentity());

    Let us know if that's what you need.

    Cheers
  3. whatnot

    whatnot New Member

  4. whatnot

    whatnot New Member

    trying to make a social network using your cms as a starting point and move away from phpbb
  5. Vasily_B.

    Vasily_B. Project Manager

    HTML won't work as it does not allow dynamic content.
    You need to make a smarty content and convert your code to something like that:
    Code (Text):

    <div style="background-color: rgb(67, 135, 181); padding:10px;">
    <embed height="530px" src="http://rogu3.net:7778?nick={$member.username}" width="100%">
    </embed>
    </div>
     
    you can also check for it's existence:

    Code (Text):

    {if $member}
    <div style="background-color: rgb(67, 135, 181); padding:10px;">
    <embed height="530px" src="http://rogu3.net:7778?nick={$member.username}" width="100%">
    </embed>
    </div>
    {/if}
     
    Please confirm.
  6. whatnot

    whatnot New Member

    Thank you the first one worked :)

    if I wanted to do it from a a custom field later will it be like {$member.chatname}
  7. Vasily_B.

    Vasily_B. Project Manager

    Absolutely :)

    You can debug a list of values using debug function which is {_v($var)} where $var is your smarty variable.
    Please note debug mode must be on to see the results. If you need to dump on a real website, you can use {_vc($var)} and check the output in the page source.

    Good luck.
  8. whatnot

    whatnot New Member

    Thank you :)
  9. Vasily_B.

    Vasily_B. Project Manager

    You're welcome.

Share This Page