Forum for discussing general topics related to Couch.
16 posts Page 1 of 2
Hi,

If a user with Super Admin logs in i want to be riderected to a different site then normal users. How can i do this?

Anyone know how?
Code: Select all
<cms:if k_user_access_level ge '10' >
<cms:redirect url='http://www.google.com/' />
</cms:if>


Put this in the login handler/wherever you want to redirect them. Change Google to the site to redirect to, it can also be a template via <cms:link 'template.php' > if need be.
Image
@kimheggen,
Please see 'extended-users' http://www.couchcms.com/docs/extended-entities/post.htm).
You can use only the 'login' part of it (by setting only the $t['login_tpl'] in its config) to use your custom template to show the login box.

In that custom template, you can set the <cms:process_login /> tag's 'redirect' parameter to '0' as discussed in the thread below to put in whatever redirect logic you wish -
viewtopic.php?p=20750#p20750

The code @Bartonsweb suggested should work there.

Hope it helps.
Bartonsweb wrote:
Code: Select all
<cms:if k_user_access_level ge '10' >
<cms:redirect url='http://www.google.com/' />
</cms:if>


Put this in the login handler/wherever you want to redirect them. Change Google to the site to redirect to, it can also be a template via <cms:link 'template.php' > if need be.


Thanks. But where do i put this code! I think im doing something wrong.

In the login.php file?
KK wrote: @kimheggen,
Please see 'extended-users' http://www.couchcms.com/docs/extended-entities/post.htm).
You can use only the 'login' part of it (by setting only the $t['login_tpl'] in its config) to use your custom template to show the login box.

In that custom template, you can set the <cms:process_login /> tag's 'redirect' parameter to '0' as discussed in the thread below to put in whatever redirect logic you wish -
viewtopic.php?p=20750#p20750

The code @Bartonsweb suggested should work there.

Hope it helps.


In my config i have the login_tpl = member/login.php

so then i find this in login.php

<cms:form method="post" anchor='0'>
<cms:if k_success >
<!--
The 'member_process_login_form' tag below expects fields named
'member_name', 'member_password' and (optionally) 'member_remember'
-->
<cms:member_process_login_form />

</cms:if>

<cms:if k_error >
<h3><font color='red'><cms:show k_error /></font></h3>
</cms:if>


Username (your email): <br/>
<cms:input type='text' name='member_name' /> <br/>

Password: <br />
<cms:input type='password' name='member_password' /> <br/>

<!-- if 'remember me' function is not required, the following checkbox can be omitted -->
<cms:input type='checkbox' name="member_remember" opt_values='Remember me=1' /> <br/>

<input type="submit" value="Login" name="submit"/>
</cms:form>

And then i dont figuer out how to use code.
@Kimheggen From what I understand you wish for users to be able to login on the front-end using the members module, but you want super-admins to be redirected to another website.

This cannot be achieved using the "members module". The members module was an early release of the more advanced version "extended users". The members module essentially uses a cloned template and pages to create users, they're not 'real' couch users and aren't listed in the "users" tab in the admin panel. If you wish for your front-end users to use couches user system, you should use the newer and more advanced "Extended users" addon. This will allow you to connect login via the front-end form using your super-admin user, and if you like, redirect them seperately (using the link @KK provided).

You can read more about extended users here: http://www.couchcms.com/docs/extended-entities/post.htm
Image
As @Bartonsweb coorectly pointed out, the code you posted pertains to 'members' addon which is different from 'extended users' that I referred you to - http://www.couchcms.com/docs/extended-entities/post.htm.

Another post that I referred to earlier shows where to place the redirection code - viewtopic.php?p=20750#p20750

Please try using the info from the links above to implement the kind of redirection you wish.
Bartonsweb wrote: @Kimheggen From what I understand you wish for users to be able to login on the front-end using the members module, but you want super-admins to be redirected to another website.

This cannot be achieved using the "members module". The members module was an early release of the more advanced version "extended users". The members module essentially uses a cloned template and pages to create users, they're not 'real' couch users and aren't listed in the "users" tab in the admin panel. If you wish for your front-end users to use couches user system, you should use the newer and more advanced "Extended users" addon. This will allow you to connect login via the front-end form using your super-admin user, and if you like, redirect them seperately (using the link @KK provided).

You can read more about extended users here: http://www.couchcms.com/docs/extended-entities/post.htm


Can you attach the extended file? Cant find it.
@kimheggen, enable it in your couch installation. /couch/addons/kfunctions.php, then uncomment extended users.
@Kimheggen

If you are using the latest version of couch, extended users is already included in the addons folder. You just need to activate it (Navigate to /couch/addons/kfunctions.php (or kfunctions.example.php if you haven't used any addons yet). If it's named kfuctions.example.php you need to rename it to just kfunctions.php

In this file there'll be a number of lines all starting with //

To activate an addon you need to "uncomment" the line (remove the // at the start)

To activate extended users you should change the line
Code: Select all
//require_once( K_COUCH_DIR.'addons/extended/extended-users.php' );


to just
Code: Select all
require_once( K_COUCH_DIR.'addons/extended/extended-users.php' );


Then you will find the tutorial makes sense. Hope this helps.

If you're not on the latest couch release, I'd suggest upgrading both for security fixes and the newer features such as the extended users.
Image
16 posts Page 1 of 2
cron