Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
on edit-profile page, doesnt show information placed in $User.SignedIn.
vanillawhisky
New
Hello there,
I have small problem regarding user signedIn.
I have this code in default.master.tpl
{if $User.SignedIn}
{module name="MeModule"} ----- line-1
{else}
{signin_link} ----- line-2
{/if}
This means when I am loggen in, loggedin informations (like notification, message, username, user image etc) shows (line-1). And when I am loggedout, loggedin buttons appears (line-2). Till this is fine.
The problem is:
When i go to 'edit profile' then it doesnt shows info. of line-1 insteed shows line-2 (with logout button). Line-2 should appear only when I am logged out right?
Can anyone help with this problem?
Thank you in advance.
Tagged:
1
Comments
Yes you are correct. The $User.SignedIn is not set in the profile edit screen. As an aside the values for smarty regarding User.... while on the edit screen refer to the user that you are viewing (sender) and not the logged in user (session).
is changed here
https://github.com/vanilla/vanilla/blob/Vanilla_2.2.1/applications/dashboard/controllers/class.profilecontroller.php#L360
but the crux of the issue is you want a me module shown on profile edit screen for some reason.
and this is purposely hidded with css, so you would have to override it, because the memodule is already there on the profile edit view but is hidden.
in the style. css it does this
so you would need to change the custom.css of your theme to override it.
or use a different display or visible option to match your needs
http://www.w3schools.com/cssref/pr_class_display.asp
http://www.w3schools.com/cssref/pr_class_visibility.asp
That said no one has ever said a good thing about the me module
https://github.com/vanilla/vanilla/blob/18498916ac071fd2f9778183c3972764b022154c/applications/dashboard/modules/class.memodule.php#L12
as shown
If you really want to test for profile edit page, (obviously the session user is logged in, otherwise they can't edit the profile, so you could use the smarty variable to test for the profile edit page if you want to do something else because UserSignedIn is not valid on profile edit.
You could theoretically request that the User Signed in variable be added to the edit method in the profile controller above here ...
https://github.com/vanilla/vanilla/blob/Vanilla_2.2.1/applications/dashboard/controllers/class.profilecontroller.php#L360
by resetting the SignedIn value for the User Array, but that would make User sub variables inconsistent since since would refer to the User you are editing in profile edit (an admin editing another user) vs. the logged in user (You!).
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
https://vanillaforums.org/discussion/comment/218833#Comment_218833
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
Thank you @River
After reading this comments i got the solution.
I check with the bodyId and if it is edit_profile page use meModule again .
Here is the code.
{if $User.SignedIn}
{module name="MeModule"}
{else}
{if $BodyID =='dashboard_profile_edit'}
{module name="MeModule"}
{else}
{signin_link}
{/if}
{/if}
Problem is solved