Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2014-07-02 19:19:54

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_members: Extends cbe_frontauth

Seems like I speak php better than english :)

Is it just the “translated” message you want to wrap, i.e. in plain english “Could not email” or “Password sent to” ?
If yes :

        $out = graf( _cbe_mb_gTxt( _cbe_mb_send_new_password( $new_pass, $email, $name, $return_url, $givenid )
                                 ? 'password_sent_to'
                                 : 'could_not_mail' )
                   )
                   .' '.htmlspecialchars( $givenid ) ;

(Additionally surrounded $givenid by htmlspecialchars)

Last edited by CeBe (2014-07-02 19:20:23)

Offline

#14 2014-07-02 23:04:17

MrPS
Member
Registered: 2011-11-09
Posts: 34

Re: cbe_members: Extends cbe_frontauth

CeBe wrote #281851:

Seems like I speak php better than english :)

Is it just the “translated” message you want to wrap, i.e. in plain english “Could not email” or “Password sent to” ?
If yes :

$out = graf( _cbe_mb_gTxt( _cbe_mb_send_new_password( $new_pass, $email, $name, $return_url, $givenid )...

(Additionally surrounded $givenid by htmlspecialchars)

It worked :), thank you.

Well I also need the following wrapped (I should have included it, at the last post):

   else
        $out = _cbe_mb_gTxt('could_not_update_author').' '.htmlspecialchars( $givenid ) ;
    return( $out ) ;
}

Offline

#15 2014-07-03 07:14:41

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_members: Extends cbe_frontauth

Perfectly logic!

        $out = graf( _cbe_mb_gTxt('could_not_update_author'), 'p').' '.htmlspecialchars( $givenid ) ;

And we even can factor, here are two versions of the entire function:

function _cbe_mb_set_author_pass( $new_pass, $name, $email, $return_url, $givenid=null )
{
    $hash = doSlash(txp_hash_password($new_pass));
    $givenid = ($givenid == null ? $name : $givenid) ;

    // Do stuff and get the result in plain english
    if( safe_update( 'txp_users', "pass = '$hash'", "name = '".doSlash($name)."'" ) )
        $out = _cbe_mb_gTxt( _cbe_mb_send_new_password( $new_pass, $email, $name, $return_url, $givenid )
                           ? 'password_sent_to'
                           : 'could_not_mail'
                           ) ;

    else
        $out = _cbe_mb_gTxt( 'could_not_update_author' ) ;

    // wrap the message into a paragraph and paste $givenid 
    return( graf( $out, 'p' ).' '.htmlspecialchars( $givenid ) ) ;
}

2nd:

function _cbe_mb_set_author_pass( $new_pass, $name, $email, $return_url, $givenid=null )
{
    $hash = doSlash(txp_hash_password($new_pass));
    $givenid = ($givenid == null ? $name : $givenid) ;

    // Do stuff and get the result in a coded message
    // ($out may be named $result_code to be more clear)
    if( safe_update( 'txp_users', "pass = '$hash'", "name = '".doSlash($name)."'" ) )
        $out = _cbe_mb_send_new_password( $new_pass, $email, $name, $return_url, $givenid )
             ? 'password_sent_to'
             : 'could_not_mail' ;

    else
        $out = 'could_not_update_author' ;

    // translate the coded message in plain english: _cbe_mb_gTxt()
    // wrap it into a paragraph: graf()
    // and paste $givenid 
    return( graf( _cbe_mb_gTxt( $out ), 'p' ).' '.htmlspecialchars( $givenid ) ) ;
}

Offline

#16 2014-07-03 10:07:35

MrPS
Member
Registered: 2011-11-09
Posts: 34

Re: cbe_members: Extends cbe_frontauth

Thank you so much Claire.

Offline

#17 2014-10-24 12:37:24

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: cbe_members: Extends cbe_frontauth

I’ve just started testing out cbe_frontauth and cbe_members to use for a new site. Sorry, but I’ll just post individual issues when I find them.

Login URL emailed to users

My development site is sitting within a folder on my main, personal site ie. URL / FOLDER.

With the ‘change password’ functionality, I find that the login URL in the email duplicates the name of the folder ie. URL / FOLDER / FOLDER.

Normally, I’m pretty good and reading through code but the bit of PHP that generates the URL has me stumped. Can someone suggest an idea to correct this?

[EDIT]

Name used in email to users

In the email sent to users confirming their new password, the greeting uses the users name. Can it be set to use their RealName instead, which is more likely to have capitalisation etc.?

Last edited by aslsw66 (2014-10-24 12:48:57)

Offline

Board footer

Powered by FluxBB