Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Support Forum

Start ::  PostNuke 0.7 Support ::  Installation, Configuration, & Upgrades ::  Echoing a username

Moderated by: Support Team

Goto page : 1 | 2 Next Page
Bottom
Echoing a username

  • Link to this postingPosted: 08.04.2005, 07:21
    Profile
    gazuz
    rank:
    Freshman Freshman
    registered:
     April 2005
    Status:
    offline
    last visit:
    14.04.05
    Posts:
    10
    Hello everyone,

    I am wondering how to echo a username. I am editing the "My account" but I want to know how to add a ref link. I have everything done already with pnAffliate but I didn't want all the mumbo jumbo that came with it, all I wanted was the ref link to display in the "My Account" portion, but I can't make it display.

    This is the only thing I have added at the end of the NS-User tool.php file. I know im missing something but I dont know what
    Code
    function pnAffiliate_user_viewtextlinks()
    {
     
    global $SERVER_NAME,$HTTP_HOST;
    $sitename = $HTTP_HOST;
    if (!isset($sitename) || empty($sitename)) $sitename=$SERVER_NAME;
    $username=pnUserGetVar('uname');

    $output->Text(_pnAffiliateAFLINK." <b>http://$sitename/?ref=$username</b>");
    }


    Thanks in advance
  • Link to this postingPosted: 08.04.2005, 09:38
    Profile Homepage
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    Try using verbatim mode?
    Code
    function pnAffiliate_user_viewtextlinks()
    {
     
    global $SERVER_NAME,$HTTP_HOST;
    $sitename = $HTTP_HOST;
    if (!isset($sitename) || empty($sitename)) $sitename=$SERVER_NAME;
    $username=pnUserGetVar('uname');

    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text(_pnAffiliateAFLINK." <b>http://$sitename/?ref=$username</b>");
    $output->SetInputMode(_PNH_PARSEINPUT);
    }

    -----
    AlarConcepts
  • Link to this postingPosted: 08.04.2005, 18:33
    Profile
    gazuz
    rank:
    Freshman Freshman
    registered:
     April 2005
    Status:
    offline
    last visit:
    14.04.05
    Posts:
    10
    nope that didnt work. I'm wondering if the function part is wrong because. where it says "function pnAffiliate_user_viewtextlinks()" I don't think thats reading it well. Is there anyway it can just echo the username such as "Welcome $username"? That's all I'm really asking Ill put the name of my website before and then it just has to add itself after the "index.php=ref?". I've seen it happen in templates and stuff but never knew how it was done
  • Link to this postingPosted: 08.04.2005, 18:48
    Profile Homepage
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    14.08.08
    Posts:
    13407
    Presumably you are actually calling the function at the right place?

    -----
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Link to this postingPosted: 08.04.2005, 19:14
    Profile Homepage
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    Simon's right...if you don't call the function in the right spot, you get a big ol' nothing. ...but if you're just looking to echo the username, you don't really need a function...after all, pnUserGetVar IS a function...so...

    ...if you're trying to do it in your theme, you can call the function by echo'ing it:
    echo pnUserGetVar('uname');

    ...whereas, if you're doing it in a module, you can call the function like this ("output" instead of echo)...
    $output->Text(pnUserGetVar('uname'));

    Does that clear it up?

    -----
    AlarConcepts
  • Link to this postingPosted: 08.04.2005, 19:16
    Profile Homepage
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    tools.php isn't parsed by the pnHTML class...

    Code
    echo pnAffiliateAFLINK." <b>http://".pnVarPrepForDisplay($sitename)."/?ref=".pnVarPrepForDisplay(pnUserGetVar('uname'))."</b>";


    Or else, you must call the class :

    Code
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);

    $output->Text(_pnAffiliateAFLINK." <b>http://$sitename/?ref=$username</b>");
    $output->SetInputMode(_PNH_PARSEINPUT);

    return $output;


    something like that...
    -----
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Link to this postingPosted: 08.04.2005, 19:18
    Profile Homepage
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    Chestnut...thanks for putting me back on track...I forgot what the original question actually was.... DOH!

    -----
    AlarConcepts
  • Link to this postingPosted: 08.04.2005, 20:01
    Profile
    gazuz
    rank:
    Freshman Freshman
    registered:
     April 2005
    Status:
    offline
    last visit:
    14.04.05
    Posts:
    10
    Sorry for this once again very noob question (im very new to PHP) but what exactly do I need to put on the end of my account page? Is this all I need or do I need more?

    Code
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);

    $output->Text(_pnAffiliateAFLINK." <b>http://$sitename/?ref=$username</b>");
    $output->SetInputMode(_PNH_PARSEINPUT);

    return $output;
  • Link to this postingPosted: 08.04.2005, 20:04
    Profile Homepage
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    I don't think I've ever ended with: return $output

    How about: return $output->GetOutput();

    ...I'm still pretty green myself...

    icon_wink

    -----
    AlarConcepts
  • Link to this postingPosted: 08.04.2005, 20:53
    Profile Homepage
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    Nice catch... forgot that last little thing...

    Hard to do it by memory... icon_smile

    Gazuz... I'm not sure you're doing the right thing... dunno why you want to add anything in the tools.php...

    Where exactly do you want that link to be shown ?

    -----
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Link to this postingPosted: 09.04.2005, 07:42
    Profile
    gazuz
    rank:
    Freshman Freshman
    registered:
     April 2005
    Status:
    offline
    last visit:
    14.04.05
    Posts:
    10
    id like each member to have their ref link ready in the "my account" section. I will make a ref contest so i want the links to be at an easy access point
  • Link to this postingPosted: 10.04.2005, 06:48
    Profile Homepage
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    On the profile page I suppose ...
    user.php?op=userinfo&uname=XXX

    Then do a simple echo in the (NS-)User/user.php in the user_userinfo function...

    The username is probably already stored in a var in the function (I don't have in front of the eyes)...

    Code
    echo "<b>http://$sitename/?ref=".pnVarPrepForDisplay($username)."</b>";

    -----
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Link to this postingPosted: 10.04.2005, 23:59
    Profile
    gazuz
    rank:
    Freshman Freshman
    registered:
     April 2005
    Status:
    offline
    last visit:
    14.04.05
    Posts:
    10
    Is there anything else thats just plain and easy 1 or 2 lines of code? all it will do is make a link to http://www.mysite.com/index.php?ref=<username> and change that <username> to the actual username without making anything new or adding more lines of code. It should already exist somewhere else and the only thing needed is to call it out. BTW im using AutoTheme Lite 0.9</username></username>
  • Link to this postingPosted: 11.04.2005, 01:32
    Profile Homepage
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    gazuzIs there anything else thats just plain and easy 1 or 2 lines of code?


    Not complicated enough ?

    You were about to add a 10 or so lines of code in tools.php while I give you a "one line" instead... So as far as "adding code" is concerned, I think you can manage it.

    That line of code wich I give again with a correction :
    (in user_userinfo() in (NS-)User/user.php)

    Code
    echo "<a href=\"http://www.YOURSITE.com/index.php?ref=".pnVarPrepPrepForDisplay($uname)."\" title=\"Ref\">Referal link</a>";


    Otherwise, no, there is nothing that will do exactly this for you. If you want to use it everywhere, than do yourself a plugin in AT if it can be done...

    But making it in the tools.php won't be of much help.

    Remember that I answer you on what you ask at first : Adding to the "My Account" the ref link for the user currently viewed.
    :wink:
    -----
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Link to this postingPosted: 14.04.2005, 06:37
    Profile
    gazuz
    rank:
    Freshman Freshman
    registered:
     April 2005
    Status:
    offline
    last visit:
    14.04.05
    Posts:
    10
    alright so the tools.php thing didnt work out too much ajnd I dropped the idea of it anyways since I found another way to do. I'd like to add it in the "Edit User Info" as a text or an already filled in box. I am not sure what file to edit either since I know there is a field to fill in in the admin area. The code can be a million lines long. But as long as I understand how to input it I'm ok with it
Goto page : 1 | 2 Next Page

Start ::  PostNuke 0.7 Support ::  Installation, Configuration, & Upgrades ::  Echoing a username

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to Zikula