Adding fields (again)

Discussion in 'Templates customization' started by Tassell, Mar 22, 2004.

  1. Tassell

    Tassell Guest

    Hello,

    Newbie...

    I copied the following code from the .pdf manual:

    Add the information for the select or radio button at the bottom of the
    config.inc.php file, just before "?>"
    Add the following at that location:

    add_member_field('where_heard', 'Where did you hear about
    us',
    'select', 'select where you heard about our site',
    '',
    array('options' => $items = array(
    'link' => 'Link from another site',
    'friend' => 'Referred by a Friend',
    'press' => 'Newspaper or Magazine',
    'other' => 'None of the above'
    ))
    );
    $config['where_heard_items'] = $items;

    The select box will now appear in the Admin Control Panel in the member profile
    To add the field to your sign up page edit the file templates/signup.html, using
    the following:
    <tr>
    <th><b>Where did you hear about us?</b><br>
    <small>please stell us how you heard about out
    site.</small></th>
    <td nowrap><select name=where_heard size=1>
    {html_options options=$config.where_heard_items
    selected=$smarty.request.where_heard}
    </select>
    </td>
    </tr>

    But I got this error:

    Fatal error: Smarty: [in signup.html line 159]: syntax error: invalid attribute name - '=' in /var/www/html/membership/smarty/Smarty_Compiler.class.php on line 1387

    Any suggestions?

    Thanks for your help,

    Marc.
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Marc,
    please rollback changes you made and follow simple producedure - go to
    aMember CP -> Add Fields, you can do everything in admin control panel
  3. Tassell

    Tassell Guest

    OK, thanks Alex.

    To update to 2.1.6 can I just replace the files with the new ones? I'd like to do this before making any more modifications.

    Thanks for your help,

    Marc
  4. Tassell

    Tassell Guest

  5. Tassell

    Tassell Guest

    As I'm about to leave work (Central European time) I might as well ask one of my other questions now (hope you don't mind)...

    I'd like to change some of the other wording such as the 'Please Login' at the top of the login page but I can't find it anywhere. Where is this kept?

    Thanks,

    Marc

    Ah! Found it! check.inc.php

    Ignore this post. Thanks.
  6. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    1. Yes.
    2. Edit file amember/templates/add_field.inc.html
  7. Tassell

    Tassell Guest

    Thanks Alex, that's great, it's all coming together nicely now.

    Here are what I think are my remaining questions, then I hope to leave you alone for a bit:

    1) I've added a <select> field to the signup page with titles Prof/Dr/Mr/Ms. I'd like to add the title to the approval_mail.txt (I know this has been covered but, for some reason, the code doesn't show on this forum).
    What should 'Dear {$name_f} {$name_l}' be if the field name is 'titlefield'?

    2) When a user logs in successfully I'd really like to have them go straight to the protected page they were targeting or, if they weren't targeting a specific page, go to the front page. In other words to completely skip the member.php which, as we only have one membership and nothing to sell, has lots of irrelevant stuff about payments/products etc. How can I redirect them?

    3) When users log out they currently go to index.html which shows up in a frame of... index.html. Not pretty. How can I direct them to the front page which is page1.html?

    Thanks again for your help.

    Marc
  8. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    1. If it is "SQL" field, then it must be
    Dear {$user.titlefield} {$name_f} {$name_l}
    If it is "not-SQL" field, then it must be
    Dear {$user.data.titlefield} {$name_f} {$name_l}

    2. Use login.php but replace in login.php :
    $redirect = $config['root_url'] . "/member.php";
    to
    $redirect = "/";

    3. aMember CP -> Setup -> php_include
  9. Tassell

    Tassell Guest

    Thanks Alex, that's all working great and my client is happy. I'm going to contradict myself now and ask you another question. Sorry.

    My front page consists of three frames (I know, not my choice and I have to live with it...). I'd like to have a 'log in' button on the top frame then, when the visitor successfully logs in have a new page open in the top frame with 'log out' replacing 'log in'. Then when the user logs out have it revert to 'log in'.

    If this is possible for a newbie to put in place :rolleyes: could you tell me how to throw up the new page each time and what code I'd need behind 'log out' for it to be a one-click ('log in' would be a simple link to the log-in page).

    Thanks, I'm really pleased with the system.

    Marc
  10. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Marc, it is possible, but I hope you forgive me, I will not give any suggestions about. It is only JavaScript/HTML question, not related with the script.
  11. Tassell

    Tassell Guest

    OK, I understand. Thanks, I'll go and do some surfing on some Javascript sites. See you later.

    Marc
  12. Tassell

    Tassell Guest

    Hope you don't mind if I post the solution I found to this problem, just in case it could be helpful to others.

    In the <head> of each protected page I put this:

    <!-- Start of loading upperframe page with logout button-->
    <script language="JavaScript">
    function reDirect() {
    parent.frames.YourFrameName.location.replace("http://www.yoursite/yourpage.php")
    }
    </script>
    <!-- End of loading upperframe page with logout button -->

    And in the <body> tag of each protected page:

    <body onload="reDirect()">

    This way, when the user logs in successfully and hits the protected page, that page loads the new page with a logout button into the desired frame (YourFrameName).

    What would happen on logout? My guess is that one could use the reDirect() function on the logout button and use it to load the page with a login button back into the YourFrameName although I haven't checked it out yet!

    Marc
  13. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    I'm not sure if I understand question. I guess you know answer better than I could ;)

Share This Page