FEU 3.1.3 - various questions

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

FEU 3.1.3 - various questions

Post by postiffm »

Running CMSMS 2.2.11. Having some problems with the new FEU. These questions will be a mix of technical "how to" questions and design questions.

1. This is my current login page:

Code: Select all

{if feu_smarty::get_current_userid()}{redirect_page page='parent-home'}{/if}
<h1>Please log in to access more information.</h1>
{FrontEndUsers action="login" returnto='parent-home'}
I struggled with getting post-login redirect to work. returnto is not documented in the FEU help. Is it correct? It seems to be used in the code. I had passed an argument in the prior edition of my code, and it worked fine.

In the .tpl file, some variables are mentioned. How and where do I set, for example, the $requested_url variable? That seems like it would be the solution to my post-login redirect problem.

2. In the FEU documentation, it mentions {redirect to=$url} a couple of times. I look in the Tags section of CMSMS, and I see redirect_url and redirect_page, but no plain redirect. What am I missing? Is a plugin the same as a tag?

3. How and where do I adjust the $msg_post_logout that is used in the orig_logout.tpl?

4. The logout page was another bugger for me. One thing I did was in the Logic for the page, I put this:

Code: Select all

{cms_module_hint module=FrontEndUsers logouttemplate="my_logoutform.tpl"}
It didn't seem to use my template. OK, so I changed the page type to the new FEU Logout link. A couple of problems came out with that. I have no option to give a module hint because the Logic page is gone with this page type. Also, the "Logout" option disappeared from the site menu. (When Members were logged in, they would get more options in the menu, one of those options being "Logout").

As to design, it seems strange to require a special case page type for a logout link.

Given this, on my login page, is it cool to call {cms_module_hint} several times, to tell FEU about all its templates, even ones not relevant to the login operation?

Code: Select all

{cms_module_hint module=FrontEndUsers logintemplate="my_loginform.tpl"}
{cms_module_hint module=FrontEndUsers logouttemplate="my_logoutform.tpl"}
{cms_module_hint module=FrontEndUsers postlogouttemplate="my_post_logout.tpl"}
5. Relative to the last line above, I am quite sure it is wrong. It is not documented in the help, and I don't see a SetParamterType for it in FrontEndUsers.module.php.

The docs say:

Code: Select all

The FEU module no longer redirects after a logout by default, as it does not know where to redirect to.

To solve this you should customize the appropriate "post_logout" template, and put your redirection in there. i.e.:

{cms_selflink href='welcome' assign='url'}{redirect to=$url}
How do I tell FEU about assets/module_custom/FrontEndUsers/templates/my_post_logout.tpl ?

6. The {cms_module_hint} doesn't seem well named in this case. Formerly, I had parameters that were sent to the FEU module when I called it for login or logout. It seems like a good place to have them, at the call site. OK, I can live with moving them out of the call line. But "hint" is not the right semantics. It is not a hint. It is a command. It is a requirement. It is an argument that is passed into the routine as a parameter. It is necessary information to the proper functioning of that thing.

Thanks for reading, and any help that you can provide.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: FEU 3.1.3 - various questions

Post by calguy1000 »

A. The mentions of {redirect} in the module help were ambiguous. I meant to explicitly mention {redirect_page} and {redirect_url}... but other plugins for redirection may exist.

B: The returnto parameter is GONE. it no longer exists or is even mentioned in the source code.

C: The mechanism to redirect after post is as mentioned in the help. and the sample template: In the factory login template this code exists inside an if expression that tests for the existance of a 'final_msg' variable.

Code: Select all

{elseif !empty($requested_url)}
         {* we have logged in... but we originally requested a different URL.  We can go back there *}
         {redirect_url to=$requested_url}
     {else}
         {* After login, we display a final message *}
         {* note: you could also redirect somewhere here:  see the redirect_page, redirect_url plugin, cms_selflink, cms_action_url and module_action_url plugins *}
         <div class="alert alert-info">{$final_msg}</div>
{/if}
[edit]FEU only the 'requested_url' smarty variable if the module is called from an error page (a 403 error page specifically). To allow redirect back to the page originally requested. i.e: User requests http://site.com/protected which generates a 403 error. Your 403 page has a call to {FrontEndUsers} on it, which provides the login page. After the user successfully logs in, the $redirect_url will have http://site.com/protected. and the factory default login form template states, that when the final message is to be displayed, AND this variable is not empty, redirect to that URL to allow the user to continue workflow. But this is changeable. You could also ensure that that variable is set globally before FEU is called.
[/edit]

OR.... you can use your own logic to redirect wherever you want (maybe based on the day of the week, or the username, or the users member groups).

D: The $msg_post_logout is just a lang string. You can change it to your own message, or your own lang string.

E: I have fixed the functionality for specifying a post_logouttemplate parameter in SVN. But you can still override the post_logout.tpl file yourself in module_custom

F: It is fine and recommended to call cms_module_hint multiple times with multiple parameters, even for multiple modules that may or may not be used on that page.

G: The cms_module_hint plugin has existed since 2.x was released, and before that there was a similar plugin in CGExtensions. It is an alternate way to provide parameters to modules. and it's usage before the module is called and before the module action is processed solves many problems with pretty URLS, security, and order-of-execution. i.e: The module doesn't have to try to carry around all the parameters that you may, or may not pass in the call to the module in the session, or in any URLS that are generated.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

Re: FEU 3.1.3 - various questions

Post by postiffm »

A. Thanks.
B. This is mostly correct. There are a few refs to returnto in action.do_userchangesettings.php but that wasn't relevant to my case.
C. I see returnto has no effect, even though I had used it. I modified the login template to have it redirect to where I want.
D. I am not knowledgeable enough to know how to create my own lang string at this moment.
E. Thanks for the fix. I am accustomed to git, so I'll have to learn svn to access your changes.
F. Thanks.
G. Roger. I know you are right about the advantages of setting up params ahead of time and I have no beef with the design. My point had to do with the name. cms_module_hint provides information that is far more than a "hint."
Have a good weekend!
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

Re: FEU 3.1.3 - various questions

Post by postiffm »

When I try to view the source code of frontendusers, cmsmadesimple.org reports

Code: Select all

Unable to find repository "frontendusers".
svn checkout http://svn.cmsmadesimple.org/svn/frontendusers

reports

Code: Select all

svn: E170013: Unable to connect to a repository at URL 'http://svn/cmsmadesimple.org/svn/frontendusers'
svn: E670002: Name or service not known
Post Reply

Return to “Modules/Add-Ons”