Title: Hardcoded variable is working but variable created from shortcode is not
Last modified: March 22, 2022

---

# Hardcoded variable is working but variable created from shortcode is not

 *  Resolved [masimansari](https://wordpress.org/support/users/masimansari/)
 * (@masimansari)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/hardcoded-variable-is-working-but-variable-created-from-shortcode-is-not/)
 * I hardcoded a variable “user” as a guid which is equal to logged in user. When
   i use the hardcoded variable the data gets just fine, however, when i try using
   the userlogin variable, it fails. However, it shows the same value when i print
   both variables.
 * {% set user = “b5f6d824-c8a6-ec11-983f-00224884c115” %}
    //essentially the user_login
   method is getting the same guid so userlogin and user variables should be the
   same {% set userlogin = “[user_login]” %} {% if userlogin is same as user %} 
   the variables are the same {% else %} the variables are different {% endif %}
 * {% fetchxml collection=’communications’ cache=’PT3S’ %}<fetch mapping=’logical’
   returntotalrecordcount=’true’><entity name=’ps_websitecommunication’><filter>
   <condition attribute=’ps_cou_contact’ operator=’eq’ value = ‘{{“#{userlogin}”}}’/
   ></filter></entity></fetch>
    {% endfetchxml %}
 * </td></tr>{% endfor %}</tbody></table>{% else %}<p>No communications found.</
   p>{% endif %}

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [alexacrm](https://wordpress.org/support/users/alexacrm/)
 * (@alexacrm)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/hardcoded-variable-is-working-but-variable-created-from-shortcode-is-not/#post-15486611)
 * [@masimansari](https://wordpress.org/support/users/masimansari/)
 * I’m not sure where `[user_login]` shortcode is coming from but shortcodes inside
   twig won’t be processed as you’d expect.
 * See the other issue you raised for the solutions: [https://wordpress.org/support/topic/putting-the-twig-code-in-my-theme-instead-of-gutenberg-block/#post-15486593](https://wordpress.org/support/topic/putting-the-twig-code-in-my-theme-instead-of-gutenberg-block/#post-15486593)
 *  Thread Starter [masimansari](https://wordpress.org/support/users/masimansari/)
 * (@masimansari)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/hardcoded-variable-is-working-but-variable-created-from-shortcode-is-not/#post-15502095)
 * Thanks for your reply. The shortcode is coming from a plugin that returns the
   user login id. Twig is correctly processing the variable and I get the output
   i want if I print that variable. But when I put it in the fetch command, it return
   an error saying despite giving me the the correct guid.
    I have put this project
   in abeyance for now due to this issue. I will get back to it in a month or so
   then I will discuss it further with you and send you the original error memssages.
 * Best regards,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hardcoded variable is working but variable created from shortcode is 
not’ is closed to new replies.

 * ![](https://ps.w.org/integration-cds/assets/icon.svg?rev=2504995)
 * [DataPress (Dataverse Integration)](https://wordpress.org/plugins/integration-cds/)
 * [Support Threads](https://wordpress.org/support/plugin/integration-cds/)
 * [Active Topics](https://wordpress.org/support/plugin/integration-cds/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/integration-cds/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/integration-cds/reviews/)

## Tags

 * [user](https://wordpress.org/support/topic-tag/user/)

 * 2 replies
 * 2 participants
 * Last reply from: [masimansari](https://wordpress.org/support/users/masimansari/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/hardcoded-variable-is-working-but-variable-created-from-shortcode-is-not/#post-15502095)
 * Status: resolved