Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Why arent authors able to reset their own settings?
We all know textpattern is capable of handling multiple authors. But why arent authors (designers, editors, writers, freelancers) unable to change their own information (passwords, real name, email)?
This question popped up in my mind during a recent <a href=“http://forum.textpattern.com/viewtopic.php?pid=64289#p64289”>discussion</a>
Last edited by creativesplash (2005-07-21 14:01:37)
“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”
— Albert Einstein
Offline
#2 2005-07-23 00:25:27
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Why arent authors able to reset their own settings?
Because nobody has submitted a clean patch to do that.
Alex
Offline
Re: Why arent authors able to reset their own settings?
I worked on the patch and I came up with a new include “txp_password.php”. The only problem is that when changing the password the user gets redirected to the admin panel. How can I make it self sustaining?
<h1>txp_password.php</h1>
<code>
$levels = array(
1 => gTxt(‘publisher’),
2 => gTxt(‘managing_editor’),
3 => gTxt(‘copy_editor’),
4 => gTxt(‘staff_writer’),
5 => gTxt(‘freelancer’),
6 => gTxt(‘designer’),
0 => gTxt(‘none’)
);
if ($event == ‘password’) { require_privs(‘password’);
$myprivs = fetch(‘priv’,‘txp_users’,‘name’,$txp_user);
if(!$step or !in_array($step, array(‘userr’,‘author_change_password’,‘change_emailid’,‘change_password’))){
userr();
} else $step();
}
// ——————————————————————————————- function userr($message=’‘) { global $myprivs,$txp_user; pagetop(gTxt(‘Change Password’),$message); $themail = fetch(‘email’,‘txp_users’,‘name’,$txp_user);
echo new_password_form(); echo change_emailid_form($themail); }
// ——————————————————————————————- function change_emailid() { global $txp_user; $new_email = gps(‘new_email’); $rs = safe_update(“txp_users”, “email = ‘$new_email’”, “name = ‘$txp_user’” ); if ($rs) { userr(‘email address changed to ‘.$new_email); } }
// ——————————————————————————————- function change_password() { global $txp_user; $message = ‘’; $themail = fetch(‘email’,‘txp_users’,‘name’,$txp_user); if (!empty($_POST[“new_pass”])) { $NewPass = $_POST[“new_pass”]; $rs = safe_update( “txp_users”, “pass = password(lower(‘$NewPass’))”, “name=’$txp_user’” ); if ($rs) { $message .= gTxt(‘password_changed’); if ($_POST[‘mailpassword’]==1) { send_new_pass($NewPass,$themail,$txp_user); $message .= sp.gTxt(‘and_mailed_to’).sp.$themail; } $message .= “.”; } else echo comment(mysql_error()); userr($message); } }
// ——————————————————————————————- function priv($priv=’‘) { global $levels; return selectInput(“priv”, $levels, $priv); }
// ——————————————————————————————- function get_priv($priv) { global $levels; return $levels[$priv]; }
// ——————————————————————————————- function send_pass($pw,$email) { global $sitename,$txp_user; $myName = $txp_user; extract(safe_row(“RealName as myName, email as myEmail”, “txp_users”, “name = ‘$myName’”));
$message = gTxt(‘greeting’).’ ‘.$_POST[‘RealName’].’,’.”\r\n”.”\r\n”.
gTxt(‘you_have_been_registered’).’ ‘.$sitename.”\r\n”.
gTxt(‘your_login_is’).’: ‘.$_POST[‘name’].”\r\n”. gTxt(‘your_password_is’).’: ‘.$pw.”\r\n”.”\r\n”.
gTxt(‘log_in_at’).’ ‘.hu.‘textpattern/index.php’;
return txpMail($email, “[$sitename] “.gTxt(‘your_login_info’), $message); }
// ——————————————————————————————- function send_new_pass($NewPass,$themail,$name) { global $txp_user,$sitename;
$message = gTxt(‘greeting’).’ ‘.$name.’,’.”\r\n”. gTxt(‘your_password_is’).’: ‘.$NewPass.”\r\n”.”\r\n”.
gTxt(‘log_in_at’).’ ‘.hu.’/index.php’;
return txpMail($themail, “[$sitename] “.gTxt(‘your_new_password’), $message); }
// ——————————————————————————————- function new_password_form() { <code>return ‘<div align=“center” style=“margin-top:3em”>’. form( tag(gTxt(‘Change Password’),‘h3’). graf(gTxt(‘New password’).’ ‘. fInput(‘password’,‘new_pass’,’‘,‘edit’,’‘,’‘,‘20’,‘1’). checkbox(‘mailpassword’,‘1’,1).gTxt(‘mail it’).’ ‘. fInput(‘submit’,‘change_pass’,gTxt(‘submit’),‘smallerbox’). eInput(‘admin’).sInput(‘change_pass’) ,’ style=“text-align:center”’) ).’</div>’;</code> }
// ——————————————————————————————- function author_change_password() { $name = ps(‘name’); $themail = safe_field(“email”,“txp_users”,“name=’”.doSlash($name).”’”); $NewPass = generate_password(6);
$rs = safe_update(“txp_users”,“pass=password(lower(‘$NewPass’))”, “`name`=’”.doSlash($name).”’”);
if ($rs) { if (send_new_pass($NewPass,$themail,$name)) { userr(gTxt(‘password_sent_to’).’ ‘.$themail); } else userr(gTxt(‘could_not_mail’).’ ‘.$themail); } else userr(gTxt(‘could_not_update_author’).’ ‘.$name);
}
// ——————————————————————————————- function change_emailid_form($themail) {
<code>return ‘<div align=“center” style=“margin-top:3em”>’. form( tag(gTxt(‘Chage Email Address’),‘h3’). graf(gTxt(‘New e-mail id’).’ ‘. fInput(‘text’,‘new_email’,$themail,‘edit’,’‘,’‘,‘20’,‘2’). fInput(‘submit’,‘change_email’,gTxt(‘submit’),‘smallerbox’). eInput(‘admin’).sInput(‘change_email’) ,’ style=“text-align:center”’) ).’</div>’;</code> }
</code>
<h1>txplib_head.php</h1>
<code>
line 147-185
function areas() { global $privs, $plugin_areas;
$areas[‘content’] = array( gTxt(‘tab_organise’) => ‘category’, gTxt(‘tab_write’) => ‘article’, gTxt(‘tab_list’) => ‘list’, gTxt(‘tab_image’) => ‘image’, gTxt(‘tab_file’) => ‘file’, gTxt(‘tab_link’) => ‘link’, gTxt(‘tab_comments’) => ‘discuss’ , gTxt(‘Change password’) => ‘password’ );
$areas[‘presentation’] = array( gTxt(‘tab_sections’) => ‘section’, gTxt(‘tab_pages’) => ‘page’, gTxt(‘tab_forms’) => ‘form’, gTxt(‘tab_style’) => ‘css’ );
$areas[‘admin’] = array( gTxt(‘tab_diagnostics’) => ‘diag’, gTxt(‘tab_preferences’) => ‘prefs’, gTxt(‘tab_site_admin’) => ‘admin’, gTxt(‘tab_logs’) => ‘log’, gTxt(‘tab_plugins’) => ‘plugin’, gTxt(‘tab_import’) => ‘import’ );
$areas[‘extensions’] = array( );
if (is_array($plugin_areas)) $areas = array_merge_recursive($areas, $plugin_areas);
return $areas;
}
</code>
<h1>admin_config.php</h1>
<code>
$txp_permissions = array(
‘admin’ => ’1,2,3,4,5,6’,
‘article.delete.own’ => ’1,2,3,4’,
‘article.delete’ => ’1,2’,
‘article.edit’ => ’1,2,3’,
‘article.edit.published’ => ’1,2,3’,
‘article.edit.own’ => ’1,2,3,4,5,6’,
‘article.publish’ => ’1,2,3,4’,
‘article.php’ => ’1,2’,
‘article’ => ’1,2,3,4,5,6’,
‘category’ => ’1,2,3’,
‘css’ => ’1,2,6’,
‘diag’ => ’1,2’,
‘discuss’ => ’1,2,3’,
‘password’ => ’1,2,3,4,5,6,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40’,
‘file’ => ’1,2,3,4,6’, ‘form’ => ’1,2,3,6’, ‘image’ => ’1,2,3,4,6’, ‘import’ => ’1,2’, ‘link’ => ’1,2,3’, ‘log’ => ’1,2,3’, // more? ‘page’ => ’1,2,3,6’, ‘plugin’ => ’1,2’, ‘prefs’ => ’1,2’, ‘section’ => ’1,2,3,6’, ‘tab.admin’ => ’1,2’, ‘tab.content’ => ’1,2,3,4,5,6’, ‘tab.extensions’ => ’1,2’, ‘tab.presentation’ => ’1,2,3,6’,
);
</code>
How can I make txp_password.php independent of txp_admin.php?
ANY IDEAS?
note: I am not a programmer so play it cool.
“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”
— Albert Einstein
Offline
Re: Why arent authors able to reset their own settings?
Any more progress on this?
Refresh Dallas and other Refreshing Cities.
Offline
Re: Why arent authors able to reset their own settings?
Absolutely none! I wish I could code it myself and release it as a plugin! I really wish!
“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”
— Albert Einstein
Offline
Re: Why arent authors able to reset their own settings?
Do it as a hdiff patch. But I don’t see any need for new code. As far as I remember, authors can already edit their infos. All we need is a link to that page. I’ll take a look at it.
Offline
#7 2005-11-21 19:07:17
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Why arent authors able to reset their own settings?
It’s pretty basic. For a while I had it under the username here, but then I just decided to fix the tabs, so its not a problem anymore (users can get at the tab easily).
No user except the publisher can change real and login names.
Last edited by Mary (2005-11-21 19:07:58)
Offline