overwrite wordpress function in site.php?

Discussion in 'Integration' started by cmireles, Jun 3, 2014.

  1. cmireles

    cmireles New Member

    Joined:
    Jul 5, 2012
    Messages:
    22
    Hey there,

    I wanted to future-proof a few modifications I have in wordpress.php. One example is the function:

    PHP:
        function getDisplayName(User $user)
        {
            switch (
    $this->getConfig('display_name''username'))
            {
                case 
    'name_f_name_l' : return $user->name_f ' ' $user->name_l;
                case 
    'username' :
                default:
                    return 
    $user->login;
            }
        }
    I'd like to modify this to create an option for Last, First. Can I do this in site.php somehow so that future upgrades will not overwrite the changes?

    Thanks!
  2. cmireles

    cmireles New Member

    Joined:
    Jul 5, 2012
    Messages:
    22
    I should add, the function is something like this, but I just want to not edit the code directly:

    Code:
        function getDisplayName(User $user)
        {
            switch ($this->getConfig('display_name', 'username'))
            {
                case 'name_f_name_l' : return $user->name_f . ' ' . $user->name_l;
                case 'name_l_name_f' : return $user->name_l . ', ' . $user->name_f;
                case 'username' :
                default:
                    return $user->login;
            }
        }
  3. tyvwz

    tyvwz New Member

    Joined:
    Jun 2, 2014
    Messages:
    1
    thanks for wonderful guidline
  4. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    I will admit I know nothing, absolutely nothing, about Wordpress but if that function is part of the Wordpress script I would think site.php - which is a part of aMember - will have no control over it.
  5. cmireles

    cmireles New Member

    Joined:
    Jul 5, 2012
    Messages:
    22
    Hi there, actually that function lives in /amember/application/default/plugins/protect/wordpress/wordpress.php - I'm just trying to find a way to modify the function slightly without editing the code directly. As I understand it, site.php for amember is for custom functions, can I add this there? Thanks-

Share This Page