Adding a link to "Useful Links"

Discussion in 'Templates customization' started by seasons1, May 6, 2010.

  1. seasons1

    seasons1 aMember Pro Customer

    Joined:
    Apr 25, 2008
    Messages:
    21
    Hello,
    I'd like to add another link on the membership page under "Useful Links"; it has the logout, change password ect. in that section. Can anyone direct me to the right file to do this?
    Thanks for your help, Theresa
  2. erwinvdb

    erwinvdb aMember Pro Customer

    Joined:
    Aug 30, 2007
    Messages:
    264
    Sure thing. The following example adds 3 links. Put the code to site.inc.php (if that file does not exist, create it).
    Code:
    setup_plugin_hook("get_member_links", "custom_links");
    function custom_links($user){
        return array("http://firstlink" => 'Description 1',
    	"http://secondlink" => 'Description 2',
    	"./thisworkstoo.php" => _SOME_VARIABLE_IN_CUSTOM_LANGUAGE_FILE);
    }
    Modify the firstlink/secondlink/thisworks and descriptions.
  3. seasons1

    seasons1 aMember Pro Customer

    Joined:
    Apr 25, 2008
    Messages:
    21
    Thank you! I looked in templates for the file and didn't see it, so I'll make it. I understand all but the thisworkstoo.php and "some variable in custom language file". What exactly do I put there? I know how to get around the files a little but don't want to guess. :)
    Theresa
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
  5. erwinvdb

    erwinvdb aMember Pro Customer

    Joined:
    Aug 30, 2007
    Messages:
    264
    ./thisworkstoo.php is called a relative link, http://secondlink is an absolute link.
    (check Google for an indepth explanation)

    _SOME_VARIABLE_IN_CUSTOM_LANGUAGE_FILE is, as Alexander described, only if you want to have the description of the links appear in different languages.
    For this to use you have to add the following line to for example en-custom.php
    Code:
    define('_SOME_VARIABLE_IN_CUSTOM_LANGUAGE_FILE', 'The description for the link you would like to display');
    
    And if you use also the Dutch language on your site you add it to nl-custom.php
    Code:
    define('_SOME_VARIABLE_IN_CUSTOM_LANGUAGE_FILE', 'Omschrijvinng voor de link die je wilt tonen');
    
  6. presscoders

    presscoders New Member

    Joined:
    Aug 3, 2009
    Messages:
    23
    Thanks, this works well. Is there a way to remove a link too. I want to be able to remove the 'Affiliates area' link under 'Useful Links'. Don't really want to hack the core files.
  7. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Disable affiliate programm? aMember CP -> Setup ->Global.
  8. sunseapromos

    sunseapromos Member

    Joined:
    Apr 26, 2010
    Messages:
    72
    I was able to add the links fine. But somewhere along the line the code is picking up a file hierarchy off of my backup on my computer instead of the site. So it is giving me a Not Found error message when I click the Logout link or the Change Password/Edit Profile link.

    The requested URL /amember/Templates/http://www.christianhomebusinessassoc.com/amember/logout.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


    I need to change the URL and remove the "Templates" directory, that is not where these pages are located, they are straight in my amember folder and I am assuming that will then remove this error and direct these links back to their appropriate pages????

    Where do I change this URL? Searched everywhere and could not find it.

    Thanx!
    Claudia
  9. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    It should be in templates that you edited.
    It seems that your HTML editor added this code. Try to download modified template again and serahc for /amember/Templates using simple editor like notepad.
  10. sunseapromos

    sunseapromos Member

    Joined:
    Apr 26, 2010
    Messages:
    72
    Yup, was my member_main.html.

    Thank you. :)
  11. hvidigaljr

    hvidigaljr New Member

    Joined:
    Apr 25, 2012
    Messages:
    9
    I've created a page called "Support" and added it to all subscribers, so the link is on "Active Products". But I actually want to display this link in the "Useful Links" field.
    How can I do this?
    Thanks
  12. charac_1

    charac_1 New Member

    Joined:
    Aug 23, 2012
    Messages:
    19
    I want to add a link to "Useful Links" and I tried the above code and received the following error:

    Fatal error: Call to undefined function setup_plugin_hook() in /home/content/11/7839711/html/amember/application/configs/site.php on line 16
  13. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    same here
    PHP Fatal error: Call to undefined function setup_plugin_hook() in /......./application/configs/site.php on line 31,

    v4.2.14

    Just realised this is V3 forum, will repost in v4 forum...
  14. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279

Share This Page