Trouble with $vars['user']

Hello,

     I am altering a SQL statement in the function get_entities_by_relationship_count in the relationships.php file in the 1.7 engine.  I am adding the clause "where e.guid = $variable"

The variable is given the value of $vars['user'] -> site_guid.  The problem is I do not think the $vars['user'] declaration has any value here.  If I hard code the variable's intended value into the  where clause (e.g. "356"), then everything works fine.  But if I use the $vars['user'] to give the variable its value, I get no result.  Any thoughts?  Thank you.

[Moderator: this comment was off-topic. It was moved to a more appropriate topic.]

  • Hello,

         I am altering a SQL statement in the function get_entities_by_relationship_count in the relationships.php file in the 1.7 engine.  I am adding the clause "where e.guid = $variable"

    The variable is given the value of $vars['user'] -> site_guid.  The problem is I do not think the $vars['user'] declaration has any value here.  If I hard code the variable's intended value into the  where clause (e.g. "356"), then everything works fine.  But if I use the $vars['user'] to give the variable its value, I get no result.  Any thoughts?  Thank you.

  • I'm not entirely sure *where* you're trying to do this but perhaps you're looking for $vars['entity']->site_guid instead

  • First, it's generally a very bad idea to alter core functions, and the change you're talking about will break this function.

    It's not working because $vars is only available in views.

    What is your end goal? You can already specify the relationship guid and inverse the relationship, so I don't understand what you're trying to do.

    [Moderator: this comment was off-topic. It was moved to a more appropriate topic.]

  • Also, please only post your question to a single forum. Asking multiple times splits the question and answers and makes it difficult for people to help you.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking