Forum Discussion

heavenerp's avatar
heavenerp
Leader
12 years ago

Is there a context object available for verified e-mail for a user?

I would like to display a message inside a custom component object using freemarker.  

 

I want it to only display for users that are registered, but have not yet verified their e-mail address.

 

Any help would be appreciated.

 

Thx!

Doug

5 Replies

  • There is no direct user freemarker context object for this, but you can use settings context object to get email verified setting and check if its true or false.The setting context object should be like  ${settings.name.get("user.email_verified")}.

     

    Hope this helps.

     

    Regards,
    Chhama

     

  • ChhamaJ's avatar
    ChhamaJ
    Khoros Staff
    12 years ago

     

    I spoke too soon, my apologies. When I tested this , it seems settings context object only works for corenode settings and not for user settings. The other option you can try is make the following restapi call to get the verification status. If the email has been verified, then the value is true else this returns nothing (blank).

     

    /restapi/vc/users/login/<login>/settings/name/user.email_verified
    or 
    /restapi/vc/users/self/settings/name/user.email_verified

     

    A point to note is that this call works only for admin or for the user itself.

     

    Hope this helps. Sorry for the confusion.

     

     

    Regards,
    Chhama

     

  • heavenerp's avatar
    heavenerp
    Leader
    12 years ago

    Thanks so much for your help. It seems that there is an issue with the "Ask a Question" widget, it will allow a user to be directed to the Post a new message page via this widget even when the user has not verified their e-mail address and the setting of "Require user to verify e-mail" has been enabled.

     

    What then happens, is that the user types their post and attempts to post the message and the page just refreshes over and over.

     

    Until this is fixed, we are placing an announcement on the post page, just for people that have not verified their e-mail address so they are aware it is a requirement.

     

    The first snippet in your 2nd reply worked, and we are going to deploy today! Thanks again.

  • IzabelaU's avatar
    IzabelaU
    Lithium Alumni (Retired)
    12 years ago

    Hi Heavenerp,

    The behavior you described with the Ask a Question widget is definitely not intended. I'm not sure yet if this is a recent regression, but I've notified our team to get this fixed in the near future. Thanks for letting us know!