• Resolved rladha

    (@rladha)


    Question:

    How to get the “WordPress user login” in the Query? $$USER$$ works in the project, but not able to get the value in Query Builder.

    SELECT * FROM WP_USERS WHERE USER_LOGIN =’$$USER$$’
    Query OK, 0 rows affected

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter rladha

    (@rladha)

    Addition: I would like to use $$USER$$ when displaying data in Publication.

    Hi there,
    you can refer to $USER$ in the WHERE condition of your template/project:
    it works perfectly at runtime.
    Hope this help.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Rahim, Marco,

    You can use the $$USER$$ variable in a publication just like a project. However, when a anonymous user accesses your publication, $$USER$$ is set to ‘anonymous’. You might need to handle this value in your where clause.

    Does this help?
    Peter

    Thread Starter rladha

    (@rladha)

    1. I found the way to add WHERE Clause in Publication it is working.
    2. But, I am finding, Search Panes (Under Premium Extension) doesn’t not take in account the WHERE Clause.

    Example:
    1. I have a list of Cities (TORONTO, MONTREAL, OTTAWA, VANCOUVER)
    2. Add a WHERE CLAUSE CITY IN (SELECT DISTINCT CITY FROM X WHERE USER_NAME = ‘$$USER$$’)
    2. USER_1 belongs to TORONTO
    3. In Tables, WHERE CAUSED applied, only TORONTO is listed
    4. But in Search Panes of Cities, it is listing all the CITIES (which should also show TORONTO.

    My application is behind the login, and would like to display data as per user’s permission.

    I hope above make sense.

    Rahim

    Proud support of this plug-in and re-newal owner of this Premium Plugins.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Rahim,

    Thank for your explanation. ?? I see the problem! The search panes query is not taking the default where clause into account. Good point! I will add it. Hope you have it after the next update.

    Thank you for your contribution,
    Peter

    Hi Peter/Rahim
    at first sight, it looks to me the same as in my previous topic:
    adding $$USER$$ reference to Lookups (Where condition similar to Page/Template ones).

    Really looking forward to hear good news.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Marco,

    Environment variables are not available in lookups. Sorry! This requires some changes in the Data Projects structure. A new Data Forms release is planned to give us more freedom in this area…

    Sorry,
    Peter

    Hi Peter,
    thanks for your feedback and.. yes, looking forward to new Data Forms release.
    I simply wished to point out that your valuable Plugin could significantly “step forward” if this will be implemented.
    Regards,
    Marco

    Thread Starter rladha

    (@rladha)

    Hi Peter,

    Is the fixed part of the latest released?

    Hi Rahim,
    
    Thank for your explanation. ?? I see the problem! The search panes query is not taking the default where clause into account. Good point! I will add it. Hope you have it after the next update.
    
    Thank you for your contribution,
    Peter

    Rahim

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Yes Rahim,

    It is fixed! Let me know if there are still other issues…

    Best regards,
    Peter

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WPDA: QUERY and $$USER$$ variable’ is closed to new replies.