Hi everybody!
I just started to develop my elgg application and I was wondering how to show error messages. I have been reading the documentation but I didn't find how to show error messages. Particularly, I have used the custom_index plugin in order to develop a nicer index page. In the index page, I have included the login form but I can not show the error when the user/pass are incorrect.
This is my login form extracted from my index page:
<form class="form-2" action="action/login" method="post">
<?php
$ts = time();
$token = generate_action_token($ts);
echo $vars;
?>
<p class="clearfix" style="margin: 10px;">
<h4 style="color:#646464;">Bienvenido a BVMC Community!</h4>
</p>
<p class="clearfix" style="margin: 10px;">
<span class="icon bvmc fa-user" style=""></span>
</p>
<p class="clearfix" style="margin: 10px;">
<!--<label for="login">Usuario</label> -->
<input type="text" name="username" id="login" placeholder="Usuario" required>
</p>
<p class="clearfix" style="margin: 10px;">
<!--<label for="password">Password</label>-->
<input type="password" name="password" id="password" placeholder="Password" required>
</p>
<input type="hidden" name="__elgg_token" value="<?php echo $token; ?>"/>
<input type="hidden" name="__elgg_ts" value="<?php echo $ts; ?>" />
<p class="clearfix" style="margin: 10px;">
<input type="submit" name="submit" value="Entrar">
</p>
</form>
If I go to the traditional login page I can see the errors if I use the wrong username.
This might be something easy but I just can't find the solution...
Thanks for your time!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 1 like
- Rohit Gupta@Rohit_1990_3676
Rohit Gupta - 1 like
- I have tried and tested this in elgg 1.12. Not sure if this will work on any other version or not.
- This will not display the error/success message as popups that is normally shown in elgg but rather as text which will be part of your content on your webpage.
- Hibernator@hibernator
Hibernator - 0 likes
You must log in to post replies.Coz you hasn't using elgg_view_layout() and form view
Just look at custom index construction:
I also struggled for the same thing for 3-4 days and then finally found a solution.
1. On top of your php file add the following code:
2. Now add the following code where you want to display the error message:
Note:
Thanks for your fast response!
My index page is completely a new view and although it might be better to use RVR approach, as I don't have much time to do the index from scratch using elgg views, I have used Rogit Gupta solution.
I will keep in touch for my next doubts or suggestions :)