Click "Save Profile" Bring To Product Home

Discussion in 'Customization & add-ons' started by stillhill, Jul 14, 2009.

  1. stillhill

    stillhill aMember Pro Customer

    Joined:
    Jun 27, 2009
    Messages:
    21
    Hello,

    I want to know how I can bring people back to their product home page after they click the save button when completing editing their profile.

    Currently it goes to member.php.. want it to go to:

    /members/ (for paid members product 1)
    /free-members/ (free free members product 6)

    Many thanks!

    Peter
  2. stillhill

    stillhill aMember Pro Customer

    Joined:
    Jun 27, 2009
    Messages:
    21
    Also wondering if I can get help with this problem:

    When the free member (product 6) buys the upgrade to the paid area (product 1) when they login they are brought to member.php

    Thinking the system no longer understands what the home page of the product now is or something.

    How can I have people who upgrade to product 1 who login, so it takes them to product 1 home page?

    Thanks,

    Peter
  3. stillhill

    stillhill aMember Pro Customer

    Joined:
    Jun 27, 2009
    Messages:
    21
    Can anyone help?
  4. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Users are directed to the product URL that you define on for the products they are subscribed.

    As you describe, If they have multiple subscriptions with different URLs configured that they will be sent to the members.php page.

    You could modify the aMember code to change this behavior, or JLogica has a Kill Product plugin which will remove them from your free product when they upgrade. They will then only be sent to the upgraded URL.
  5. stillhill

    stillhill aMember Pro Customer

    Joined:
    Jun 27, 2009
    Messages:
    21
    OK yea that should do it... can you tell me how to edit the "Save Profile" button so it directs people to their product home versus member.php once they click?

    Peter :)
  6. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    in amember\profile.php around line 156 there is:
    Code:
    html_redirect("member.php", false,
    as a part of the display_saved function which you can probably adjust..

    Perhaps someone has a less 'hack' way of doing it though.
  7. stillhill

    stillhill aMember Pro Customer

    Joined:
    Jun 27, 2009
    Messages:
    21
    Hmmm I bet that's the code I need to change. I just installed the plugin and the login problem is fixed. Now when someone pays and logs in, they are directed to the proper home page :) Many thanks.

    So can anyone step in and tell me how to make it so when a customer clicks "Save Profile" or "Back" they are directed to their products home page?

    Many thanks... looks like that's all I need now! amamber rocks!

    Peter
  8. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    stillhill I would have thought pretty easy particually as you say just two products are involved.

    If you look at http://www.amember.com/forum/showthread.php?t=10328 and reply #5 where I described how I changed member.php so it would always redirect to members.html page relevant to payment status.
    PHP:
    $t->assign('member_links'$member_links);
    $left_member_links plugin_get_left_member_links($_SESSION['_amember_user']);
    $t->assign('left_member_links'$left_member_links);
    $t->assign('user'$_SESSION['_amember_user']);

    // Customisation 1 - Added to direct to members.html or pending.html

    $mem_status = ($_SESSION['_amember_user'][status]);

    if(
    $mem_status == '0') {
        
    $t->display('pending.html');
    }else {
        
    $t->display('member.html');

    Why not change the session variable to check for product id (I think something like $_SESSION['_amember_products'][0][product_id] so you end up with something along lines of
    PHP:
    $mem_prod = ($_SESSION['_amember_products'][0][product_id]);

    if(
    $mem_prod == '1') {
        
    $t->display('paidup.html');
    }else {
        
    $t->display('free.html');
    Doing it this way your members will always be directed to the correct page regardless of which route they take to get to the existing members.html file even if they try cheating and enter 'member.php' in the address bar.
  9. stillhill

    stillhill aMember Pro Customer

    Joined:
    Jun 27, 2009
    Messages:
    21
    Interesting... I had a friend do this in profile.php and it worked... I will have him look at your solution:

    function display_saved(){
    global $t, $db;
    global $_amember_id;

    $user = $db->get_user($_amember_id);

    $pl = array();
    $dat = date('Y-m-d'); // get today date in SQL format
    foreach ($db->get_user_payments($_amember_id, 1) as $p){
    if (($p['begin_date']<=$dat) && ($p['expire_date']>=$dat)){
    $pl[] = $p;
    }
    }
    // now $pl contains only completed and non-expired payments
    //print_rr($pl, 'active payments');

    $pr = $pl[0]['product_id'];

    if ( $pr == 1 )
    {
    html_redirect("/members/home/", false,
    _TPL_PROFILE_SAVED_TITLE, _TPL_PROFILE_SAVED_SUCCESS);
    }
    else if ( $pr == 6 )
    {
    html_redirect("/free-members/", false,
    _TPL_PROFILE_SAVED_TITLE, _TPL_PROFILE_SAVED_SUCCESS);
    }
    else
    {
    html_redirect("member.php", false,
    _TPL_PROFILE_SAVED_TITLE, _TPL_PROFILE_SAVED_SUCCESS);
    }
    }

    Many thanks to everyone who chimed in here!!!

    Peter

Share This Page