[SOLVED] _UE_REGISTERFORPROFILE - redirect to login page

13 years 4 months ago #147621 by jeremy04
Hey guys

I want to know how to create a trigger (without modifying the CB core) to redirect a user when they see
_UE_REGISTERFORPROFILE ..

Specifically a user who isn't logged and happens to visit the index.php?option=com_comprofiler URL
and sees "Please login or register to view or modify your profile"

Instead redirect to the login page.
I know how to write the code, I just don't want to edit the CB core.

www.e-webstyle.com/techinfo/index.php/joomla/joomla-community-builder-please-log-in-or-register-to-view-or-modify-your-profile/

This is how I could do it...

Thanks,
Jeremy

Post edited by: krileon, at: 2010/12/06 15:39

Please Log in to join the conversation.

13 years 4 months ago #147681 by krileon
Can't suggest editing the core, but you could make a Joomla system plugin that checks the URL the user is at and if is at a access denied page you could perform the redirect. Otherwise you'll need to review comprofiler.php and search for locations that the error message is presented.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 4 months ago #147710 by jeremy04
Ok Thanks! Was wondering if there was anything else I could do.

Please Log in to join the conversation.

13 years 4 months ago #147778 by jeremy04
If anybody is interested here is the plugin code that will redirect for all tasks except "register" and "login":

[code:1]<?php
/**
* @version $Id: redirect.php 10709 2008-08-21 09:58:52Z eddieajau $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php

* Jeremy Lipson
* Redirect on Login
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );

/**
* Redirect plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemRedirect extends JPlugin
{
function plgSystemRedirect(& $subject, $config)
{
parent::__construct($subject, $config);
}
function onAfterRender()
{
$application = JFactory::getApplication();
$pageoption = JRequest::getVar( 'option', '' );
$whole = JRequest::get( 'get' );
$user = &JFactory::getUser();
$u =& JFactory::getURI();
$redirectUrl = $u->toString($parts=array('query', 'fragment'));
$loginUrl = "index.php?option=com_comprofiler&task=login";
if (($user->id == 0) && ($pageoption==="com_comprofiler"«») && ($whole!="login"«») &&($whole!="registers"«»)) {
$application->redirect($loginUrl, "Please login,sir"«»);
}
}
}
?>[/code:1]

This only will work with 1.2.3, so this code is not Upgrade-proof. The URLs for login / registration can change... Please tell me if there is anything I can besides this. Thanks.

Post edited by: jeremy04, at: 2010/12/04 23:07

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.193 seconds

Facebook Twitter LinkedIn