modify the registration, member , forgot password forms.
Posted: 28 October 2006 08:38 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  224
Joined  04-28-2006

Hello all,

In addition to this topic http://expressionengine.com/forums/viewthread/39507/ i’am trying to write an extension never done it before but its still a little confusing.

The thing is when i go to member/registration/nl it gives me a blank page and says bad uri.
So can somebody tell me what hooks i would need for this?

I tried this unfortunately it doesn’t work. When i go to host.be/index.php/member/registration/en it still gives me the old form. Maybe somebody can give me some directions…

Thanks in advance,

<?php

class memberlanguage {
    
var $settings        = array();
    
    var
$name            = 'Member language';
    var
$version        = '0.1';
    var
$description    = 'Thiss will allow to give a language parameter to the member pages';
    var
$settings_exist    = 'n';
    var
$docs_url        = 'http://www.thisconnect.be/docs';
    
    
//
    // Constructor
    //
    
function memberlanguage($settings=''){
        $this
->settings = $settings;
    
}
    
    
//
    // Add to database
    //
    
    
function activate_extension ()
    
{
        
global $DB;
        
        
// -- Add edit_field_groups
        
$DB->query(
            
$DB->insert_string('exp_extensions',
                array(
                        
'extension_id' => '',
                        
'class'        => 'memberlanguage',
                        
'method'       => 'addlanguage',
                        
'hook'         => 'member_member_register_start',
                        
'settings'     => '',
                        
'priority'     => 10,
                        
'version'      => $this->version,
                        
'enabled'      => 'n'
                
)
            )
        );
    
}
    
    
// --------------------------------
    //  Update Extension
    // --------------------------------  

    
function update_extension($current='')
    
{
        
    }
    
    
function addlanguage(){
        
global $DSP, $DB, $EXT;

        
$EXT->end_script = TRUE;

        
$DSP->body = '<tr>
        <td class="tableCellTwo" style="width:45%;">
        <div class="defaultBold"> Company Name</div>

        </td>
        <td class="tableCellOne" style="width:55%;"><input type="text" name="m_field_id_1" value="" class="input" maxlength="100" size="40" style="width:300px;" /></td>

        </tr>'
;
    
}
}
        
?>

Profile
 
 
Posted: 29 October 2006 11:17 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  224
Joined  04-28-2006

How can you find out what hooks are being called when you visit a webpage? I think i’am using the wrong hookup for what i want to do.

I hope somebody can help me!

Profile
 
 
Posted: 29 October 2006 11:31 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  224
Joined  04-28-2006

Ok i fixed it for now.
But i have hacked the mod.member.php file I’am looking for a much nicer way of doing this. Without having to worry each update that EE changes something so that my hack doesn’t work anymore.
Lisa told me it could be done with a extension i would prefer this method but no clue on what hook i would need or if it even exists.

The hack:

In the page mod.member.php i have changed :

if ( ! in_array($this->request, $this->id_override) AND $this->cur_id != '' AND ! is_numeric($this->cur_id))
         
{
             
return FALSE;
         
}

to

if ( ! in_array($this->request, $this->id_override) AND $this->cur_id != '' AND ! is_numeric($this->cur_id))
         
{
             
if( $this->cur_id != "nl" && $this->cur_id != "en"){
                 
return FALSE;
             
}
         }

Profile
 
 
Posted: 30 October 2006 02:14 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  224
Joined  04-28-2006

this seems to be a very difficult question ::looksfunny::

Profile
 
 
Posted: 30 October 2006 02:29 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  879
Joined  02-05-2002

If I understand correctly, you want to show the /member/register/ page in the current language selected by the guest user? (anonymous user)

If so, you can use the Template Language Plugin to override the system wide language setting.
You need to use the “exp:template_language:future” tag, and add it to your regular templates, or at least the one that contains the “register” link to the /member/register/ page.

If your language variable is stored in segment_3, the code would look like this:

{exp:template_language:future language="{segment_3}"}

Hope this helps.

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 30 October 2006 02:38 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  224
Joined  04-28-2006

hey,

Yes what you are saying is the following logical step. But first it must be possible to give the language along in the url on the registration and login pages. When you change the profile trigger name. You should try www.host.be/profiletriggername/register/en this will give you a error. So that is my first concern keeping the language all time in the url. This is still a problem until now. When i use my hack it allows me to give it along but when the page is returned the language is lost.

Greets,

Profile
 
 
Posted: 30 October 2006 02:42 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  879
Joined  02-05-2002

I can understand you might _want_ the language in your URL, but using this technique you do not need it!

The language will be set in a previous template, using the variable in your URL and transferred to your member page automagically (using a cookie if I’m not mistaken)

So, this is not the “following logical step” but a solution wink

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 30 October 2006 03:57 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  224
Joined  04-28-2006

hey thanks for your reply i’am trying it now. But one more question how can i fetch the current localization language? So my frontend can use it.

Thanks again!!

Profile
 
 
Posted: 30 October 2006 04:08 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  879
Joined  02-05-2002

This will return the current language:

<?php
    
global $SESS;
    echo
$SESS->userdata['language']
?>

The plugin example code I gave you is not correct, it needs the full name of the language to function, so this won’t work:

{exp:template_language:future language="{segment_3}"}

You should end up with something like this:

{exp:template_language:future language="dutch"}

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 30 October 2006 10:57 AM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  224
Joined  04-28-2006

oke right look no further!
This is THE and ONLY way to do multilangual sites http://expressionengine.com/wiki/Multi_language_site_alternative/ IT WORKS GREAT! and all my problems solved smile

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65030 Total Logged-in Users: 21
Total Topics: 82119 Total Anonymous Users: 18
Total Replies: 441326 Total Guests: 189
Total Posts: 523445    
Members ( View Memberlist )
Newest Members:  cfvicdreamNOIRgmonCooperWrightReedsmeenoiYang.JianuoioitsukiNathan Hammondalexcig